Module: Crew::Task::Arguments::DSL
- Included in:
- DSL
- Defined in:
- lib/crew/task/arguments/dsl.rb
Instance Attribute Summary collapse
-
#_arguments ⇒ Object
Returns the value of attribute _arguments.
Class Method Summary collapse
Instance Method Summary collapse
- #arg(name, desc = nil, opts = {}) ⇒ Object
- #args(name, desc = nil, opts = {}) ⇒ Object
- #opt(name, desc = nil, opts = {}) ⇒ Object
Instance Attribute Details
#_arguments ⇒ Object
Returns the value of attribute _arguments.
5 6 7 |
# File 'lib/crew/task/arguments/dsl.rb', line 5 def _arguments @_arguments end |
Class Method Details
.load(arguments, &blk) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/crew/task/arguments/dsl.rb', line 7 def self.load(arguments, &blk) loader = Class.new do include DSL end.new loader._arguments = arguments loader.instance_eval(&blk) if blk end |
Instance Method Details
#arg(name, desc = nil, opts = {}) ⇒ Object
15 16 17 18 |
# File 'lib/crew/task/arguments/dsl.rb', line 15 def arg(name, desc = nil, opts = {}) opts, desc = desc, nil if desc.is_a?(Hash) _arguments.define(name, :required, desc, opts) end |
#args(name, desc = nil, opts = {}) ⇒ Object
20 21 22 23 |
# File 'lib/crew/task/arguments/dsl.rb', line 20 def args(name, desc = nil, opts = {}) opts, desc = desc, nil if desc.is_a?(Hash) _arguments.define(name, :glob, desc, opts) end |
#opt(name, desc = nil, opts = {}) ⇒ Object
25 26 27 28 |
# File 'lib/crew/task/arguments/dsl.rb', line 25 def opt(name, desc = nil, opts = {}) opts, desc = desc, nil if desc.is_a?(Hash) _arguments.define(name, :opt, desc, opts) end |