Class: FerretsOnFire::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/ferrets_on_fire/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, desc, default, &block) ⇒ Command

Returns a new instance of Command.



7
8
9
10
11
12
13
14
# File 'lib/ferrets_on_fire/command.rb', line 7

public def initialize(name, desc, default, &block)
  @name = name.to_sym
  @desc = desc
  @default = default

  define_singleton_method(:dispatch, block)
  dispatch
end

Instance Attribute Details

#action_blockObject (readonly)

Returns the value of attribute action_block.



4
5
6
# File 'lib/ferrets_on_fire/command.rb', line 4

def action_block
  @action_block
end

#argsObject

Returns the value of attribute args.



5
6
7
# File 'lib/ferrets_on_fire/command.rb', line 5

def args
  @args
end

#defaultObject (readonly)

Returns the value of attribute default.



4
5
6
# File 'lib/ferrets_on_fire/command.rb', line 4

def default
  @default
end

#descObject (readonly)

Returns the value of attribute desc.



4
5
6
# File 'lib/ferrets_on_fire/command.rb', line 4

def desc
  @desc
end

#global_optionsObject

Returns the value of attribute global_options.



5
6
7
# File 'lib/ferrets_on_fire/command.rb', line 5

def global_options
  @global_options
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/ferrets_on_fire/command.rb', line 4

def name
  @name
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/ferrets_on_fire/command.rb', line 5

def options
  @options
end

Instance Method Details

#action(&block) ⇒ Object



16
17
18
# File 'lib/ferrets_on_fire/command.rb', line 16

public def action(&block)
  @action_block = block
end