Class: Pyer::Command
- Inherits:
-
Object
- Object
- Pyer::Command
- Defined in:
- lib/pyer/options.rb
Overview
Command class
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.
269 270 271 272 273 274 |
# File 'lib/pyer/options.rb', line 269 def initialize(name, description, &block) @name = name.to_s fail 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.
262 263 264 |
# File 'lib/pyer/options.rb', line 262 def callback @callback end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
262 263 264 |
# File 'lib/pyer/options.rb', line 262 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
262 263 264 |
# File 'lib/pyer/options.rb', line 262 def name @name end |