Module: Lich::Gemstone::Infomon::Parser::State

Defined in:
lib/gemstone/infomon/parser.rb

Constant Summary collapse

Goals =
:goals
Profile =
:profile
Ready =
:ready

Class Method Summary collapse

Class Method Details

.getSymbol

Gets the current state of the parser.

Returns:

  • (Symbol)

    The current state of the parser.



128
129
130
# File 'lib/gemstone/infomon/parser.rb', line 128

def self.get
  @state
end

.set(state) ⇒ Object

Sets the current state of the parser.

Parameters:

  • state (Symbol)

    The state to set, must be one of Goals or Profile.

Raises:

  • (RuntimeError)

    If the state is invalid or if the state transition is not allowed.



115
116
117
118
119
120
121
122
123
124
# File 'lib/gemstone/infomon/parser.rb', line 115

def self.set(state)
  case state
  when Goals, Profile
    unless @state.eql?(Ready)
      Lich.log "error: Infomon::Parser::State is in invalid state(#{@state}) - caller: #{caller[0]}"
      fail "--- Lich: error: Infomon::Parser::State is in invalid state(#{@state}) - caller: #{caller[0]}"
    end
  end
  @state = state
end