Class: Pyer::Options::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/pyer/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#callbackObject (readonly)

Returns the value of attribute callback.



310
311
312
# File 'lib/pyer/options.rb', line 310

def callback
  @callback
end

#descriptionObject (readonly)

Returns the value of attribute description.



310
311
312
# File 'lib/pyer/options.rb', line 310

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



310
311
312
# File 'lib/pyer/options.rb', line 310

def name
  @name
end