Module: Lich::Gemstone::Infomon::Parser::State
- Defined in:
- documented/gemstone/infomon/parser.rb
Overview
Manages the state of the Infomon parser.
This module keeps track of the current state of the parser, allowing transitions between different states such as ready, goals, and profile.
Constant Summary collapse
- Goals =
:goals- Profile =
:profile- Ready =
:ready- EnhanciveStats =
Enhancive parsing states
:enhancive_stats- EnhanciveSkills =
:enhancive_skills- EnhanciveResources =
:enhancive_resources- EnhanciveMartial =
:enhancive_martial- EnhanciveSpells =
:enhancive_spells- EnhanciveStatistics =
:enhancive_statistics
Class Method Summary collapse
-
.enhancive_state? ⇒ Boolean
Checks if the current state is one of the enhancive states.
-
.get ⇒ Symbol
Retrieves the current state of the parser.
-
.set(state) ⇒ void
Sets the current state of the parser.
Class Method Details
.enhancive_state? ⇒ Boolean
Checks if the current state is one of the enhancive states.
201 202 203 204 |
# File 'documented/gemstone/infomon/parser.rb', line 201 def self.enhancive_state? [EnhanciveStats, EnhanciveSkills, EnhanciveResources, EnhanciveMartial, EnhanciveSpells, EnhanciveStatistics].include?(@state) end |
.get ⇒ Symbol
Retrieves the current state of the parser.
194 195 196 |
# File 'documented/gemstone/infomon/parser.rb', line 194 def self.get @state end |
.set(state) ⇒ void
This method returns an undefined value.
Sets the current state of the parser.
This method validates the state transition and updates the internal state variable.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'documented/gemstone/infomon/parser.rb', line 174 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 when EnhanciveStats, EnhanciveSkills, EnhanciveResources, EnhanciveMartial, EnhanciveSpells, EnhanciveStatistics # Enhancive states can start from Ready or transition between each other unless @state.eql?(Ready) || enhancive_state? 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 |