Class: StateMachine::OOStructuredFSM::AttributeState

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

Overview

Class responsible for handling attribute state.

Instance Method Summary collapse

Methods inherited from OOStructuredState

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

Constructor Details

#initialize(pLanguage) ⇒ AttributeState

Returns a new instance of AttributeState.



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

def initialize(pLanguage)
  @language = pLanguage
end

Instance Method Details

#class_captureObject

See Also:



21
22
23
# File 'lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb', line 21

def class_capture
  @language.rewind_state
end

#execute(pElementFile, pLine) ⇒ Object

See Also:



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

def execute(pElementFile, pLine)
  attributeElement = @language.attributeHandler.get_attribute(pLine)

  if attributeElement
    # Add attribute to the last class
    lastIndex = pElementFile.classes.length - 1 # We want the index
    attributeElement.each do |attribute|
      attribute.comments = @language.string_comment_to_transfer
    end
    @language.string_comment_to_transfer = ""
    pElementFile.classes[lastIndex].add_attribute(attributeElement)
  end

  class_capture
  return pElementFile
end

#handle_line(pLine) ⇒ Object

See Also:



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

def handle_line(pLine)
end