Class: Pyer::Options::Command
- Inherits:
-
Object
- Object
- Pyer::Options::Command
- Defined in:
- lib/pyer/options.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, description, &block) ⇒ Command
constructor
Incapsulate internal command.
Constructor Details
#initialize(name, description, &block) ⇒ Command
Incapsulate internal command.
name - The String or Symbol command name. description - The String description text. block - An optional block.
317 318 319 320 321 322 |
# File 'lib/pyer/options.rb', line 317 def initialize(name, description, &block) @name = name.to_s raise InvalidCommandError, "Command #{@name} is invalid" if @name.start_with?('-') @description = description @callback = (block_given? ? block : nil) end |
Instance Attribute Details
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
310 311 312 |
# File 'lib/pyer/options.rb', line 310 def callback @callback end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
310 311 312 |
# File 'lib/pyer/options.rb', line 310 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
310 311 312 |
# File 'lib/pyer/options.rb', line 310 def name @name end |