module PoiseLanguages::Command::Mixin::Resource::ClassMethods

Public Instance Methods

included(klass) click to toggle source

@api private

Calls superclass method
# File lib/poise_languages/command/mixin.rb, line 152
def included(klass)
  super
  klass.extend(ClassMethods)
end
language_command_default_binary(val=Poise::NOT_PASSED) click to toggle source
# File lib/poise_languages/command/mixin.rb, line 146
def language_command_default_binary(val=Poise::NOT_PASSED)
  @language_command_default_binary = val if val != Poise::NOT_PASSED
  @language_command_default_binary
end
language_command_mixin(name, runtime: :" click to toggle source

Configure this module or class for a specific language.

@param name [Symbol] Language name. @param runtime [Symbol] Language runtime resource name. @param timeout [Boolean] Enable the timeout attribute. @param default_binary [String] Name of the default language binary. @return [void]

# File lib/poise_languages/command/mixin.rb, line 127
def language_command_mixin(name, runtime: :"#{name}_runtime", timeout: true, default_binary: nil)
  # Create the parent attribute.
  parent_attribute(name, type: runtime, optional: true)

  # Timeout attribute for the shell_out wrappers in the provider.
  attribute(:timeout, kind_of: Integer, default: 900) if timeout

  # Create the main accessor for the parent/path.
  define_method(name) do |val=Poise::NOT_PASSED|
    language_command_runtime(name, runtime, default_binary, val)
  end

  # Create the method to inherit settings from another resource.
  define_method(:"#{name}_from_parent") do |resource|
    language_command_runtime_from_parent(name, resource)
  end
  private :"#{name}_from_parent"
end