Class: Configs::States
- Defined in:
- scripts/00800 Studio/00000 Configs/00003 States.rb
Overview
Configuration of states
Instance Attribute Summary collapse
-
#ids ⇒ Hash<Symbol => Integer>
Get the ID of states.
Instance Method Summary collapse
-
#initialize ⇒ States
constructor
A new instance of States.
-
#symbol(id) ⇒ Symbol?
Get the symbol of a state from its id.
- #to_json
Constructor Details
#initialize ⇒ States
Returns a new instance of States.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 8 def initialize @ids = { poison: 1, paralysis: 2, burn: 3, sleep: 4, freeze: 5, confusion: 6, toxic: 8, death: 9, ko: 9, flinch: 7 } end |
Instance Attribute Details
#ids ⇒ Hash<Symbol => Integer>
Get the ID of states
6 7 8 |
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 6 def ids @ids end |
Instance Method Details
#symbol(id) ⇒ Symbol?
Get the symbol of a state from its id
25 26 27 |
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 25 def symbol(id) @ids.key(id) end |
#to_json
29 30 31 32 33 34 |
# File 'scripts/00800 Studio/00000 Configs/00003 States.rb', line 29 def to_json(*) { klass: self.class.to_s, ids: @ids }.to_json end |