Module: Amp::KernelMethods
- Defined in:
- lib/amp/commands/command.rb,
lib/amp/templates/template.rb
Instance Method Summary collapse
-
#command(name, &block) ⇒ Object
shortcut.
-
#cut! ⇒ Object
Stops the command from running any further - uses the global options.
-
#namespace(name) ⇒ Object
Rake style namespacing After new commands are made, alter their names so that they’re “##namespace:##command” NOTE: THIS IS NOT RAKE-FRIENDLY If you load this into a script with Rake, they will fight to the death and only one will have a proper namespace method!.
- #template(name, *args) ⇒ Object
Instance Method Details
#command(name, &block) ⇒ Object
shortcut
486 487 488 |
# File 'lib/amp/commands/command.rb', line 486 def command(name, &block) Amp::Command.new name, &block end |
#cut! ⇒ Object
Stops the command from running any further - uses the global options.
492 |
# File 'lib/amp/commands/command.rb', line 492 def cut!; $break = true; end |
#namespace(name) ⇒ Object
Rake style namespacing After new commands are made, alter their names so that they’re “##namespace:##command” NOTE: THIS IS NOT RAKE-FRIENDLY If you load this into a script with Rake, they will fight to the death and only one will have a proper namespace method!
500 501 502 503 504 505 |
# File 'lib/amp/commands/command.rb', line 500 def namespace(name) # current commands Amp::Command.use_namespace name.to_s yield Amp::Command.pop_namespace end |
#template(name, *args) ⇒ Object
156 157 158 159 160 161 162 163 |
# File 'lib/amp/templates/template.rb', line 156 def template(name, *args) if args.size > 2 || args.empty? raise ArgumentError.new('Usage of template: template(name, text)'+ 'or template(name, renderer, text)') end template = (args.size > 1) ? args[0] : :erb Support::Template.new(name, template, args.last) end |