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

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

Overview

This module manages the state of the parser.

Examples:

Setting the state

State.set(State::Goals)

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.getSymbol

Retrieves the current state of the parser.

Returns:

  • (Symbol)

    The current state.



284
285
286
# File 'documented/gemstone/infomon/parser.rb', line 284

def self.get
  @state
end

.set(state) ⇒ void

This method returns an undefined value.

Sets the current state of the parser.

Examples:

Setting the state

State.set(State::Goals)

Parameters:

  • state (Symbol)

    The state to set.

Raises:

  • (RuntimeError)

    if the state is invalid.



271
272
273
274
275
276
277
278
279
280
# File 'documented/gemstone/infomon/parser.rb', line 271

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