Class: StateMachine::OOStructuredFSM::VariableState

Inherits:
OOStructuredState show all
Defined in:
lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb

Overview

Handling variable state.

Instance Method Summary collapse

Methods inherited from OOStructuredState

#aggregation_capture, #attribute_capture, #class_capture, #comment_capture, #conditional_capture, #constructor_capture, #function_capture, #include_capture, #method_capture, #module_capture, #repetition_capture, #variable_capture

Constructor Details

#initialize(pLanguage) ⇒ VariableState

Returns a new instance of VariableState.



12
13
14
# File 'lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb', line 12

def initialize(pLanguage)
  @language = pLanguage
end

Instance Method Details

#execute(pElementFile, pLine) ⇒ Object

See Also:



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb', line 27

def execute(pElementFile, pLine)
  variableList = @language.variableHandler.get_variable(pLine)
  if variableList
    variableList.each do |variable|
      variable.comments = @language.string_comment_to_transfer
    end
    @language.string_comment_to_transfer = ""
    pElementFile.add_global_variable(variableList)
  end

  idle_capture
  return pElementFile
end

#handle_line(pLine) ⇒ Object

See Also:



17
18
19
# File 'lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb', line 17

def handle_line(pLine)
  idle_capture
end

#idle_captureObject

See Also:



22
23
24
# File 'lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb', line 22

def idle_capture
  @language.set_state(@language.idleState)
end