Class: CommandBuilder::CodeGenerator::Command

Inherits:
Node
  • Object
show all
Defined in:
lib/command_builder/code_generator/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#args, #branch?, #child_nodes, #fragments, #leaf?

Constructor Details

#initialize(command_def) ⇒ Command

Returns a new instance of Command.



11
12
13
14
15
16
17
18
19
# File 'lib/command_builder/code_generator/command.rb', line 11

def initialize(command_def)
  hash = Command.command_hash command_def
  command_text = hash.keys[0]
  command_name = Command.command_name command_text
  node_def = command_text[command_name.length, command_text.length]
  super node_def
  Command.process_array hash.values[0], self
  @command_name = command_name
end

Instance Attribute Details

#command_nameObject (readonly)

Returns the value of attribute command_name.



9
10
11
# File 'lib/command_builder/code_generator/command.rb', line 9

def command_name
  @command_name
end

Instance Method Details

#node_nameObject



21
22
23
# File 'lib/command_builder/code_generator/command.rb', line 21

def node_name
  @node_name ||= node_alias || @command_name
end