Module: Albacore::CliDSL::ClassMethods
- Defined in:
- lib/albacore/cli_dsl.rb
Instance Method Summary collapse
-
#command(*command_names, &block) ⇒ Object
Defines an instance method based on the first command name.
-
#command_prefix ⇒ Object
The prefix for any instance method defined by the ::command method.
Instance Method Details
#command(*command_names, &block) ⇒ Object
Defines an instance method based on the first command name. The method executes the code of the given block. Aliases methods for any subsequent command names.
29 30 31 32 33 34 35 |
# File 'lib/albacore/cli_dsl.rb', line 29 def command(*command_names, &block) method_name = "#{command_prefix}#{command_names.shift}" define_method method_name, &block command_names.each do |c| alias_method "#{command_prefix}#{c}", method_name end end |
#command_prefix ⇒ Object
The prefix for any instance method defined by the ::command method.
38 39 40 |
# File 'lib/albacore/cli_dsl.rb', line 38 def command_prefix :_run_ end |