Class: Consoler::Command

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

Overview

Consoler command

Basically a named hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Command

Create a command

Parameters:

  • options (Hash)

Options Hash (options):

  • :command (String)

    Name of the command

  • :options (Consoler::Options)

    List of all options

  • :action (Proc)

    Action for this command



22
23
24
25
26
# File 'lib/consoler/command.rb', line 22

def initialize(options)
  @command = options[:command]
  @options = options[:options]
  @action = options[:action]
end

Instance Attribute Details

#actionProc (readonly)

Action for this command

Returns:

  • (Proc)

    the current value of action



11
12
13
# File 'lib/consoler/command.rb', line 11

def action
  @action
end

#commandString (readonly)

Name of the command

Returns:

  • (String)

    the current value of command



11
12
13
# File 'lib/consoler/command.rb', line 11

def command
  @command
end

#optionsConsoler::Options (readonly)

List of all options

Returns:



11
12
13
# File 'lib/consoler/command.rb', line 11

def options
  @options
end