Class: Cyclotone::State
- Inherits:
-
Object
- Object
- Cyclotone::State
- Includes:
- Singleton
- Defined in:
- lib/cyclotone/state.rb
Instance Method Summary collapse
- #get_f(key) ⇒ Object
- #get_i(key) ⇒ Object
- #get_s(key) ⇒ Object
-
#initialize ⇒ State
constructor
A new instance of State.
- #set_f(key, value) ⇒ Object
- #set_i(key, value) ⇒ Object
- #set_s(key, value) ⇒ Object
Constructor Details
#initialize ⇒ State
Returns a new instance of State.
9 10 11 12 |
# File 'lib/cyclotone/state.rb', line 9 def initialize @values = {} @mutex = Mutex.new end |
Instance Method Details
#get_f(key) ⇒ Object
26 27 28 |
# File 'lib/cyclotone/state.rb', line 26 def get_f(key) read(key)&.to_f end |
#get_i(key) ⇒ Object
30 31 32 |
# File 'lib/cyclotone/state.rb', line 30 def get_i(key) read(key)&.to_i end |
#get_s(key) ⇒ Object
34 35 36 |
# File 'lib/cyclotone/state.rb', line 34 def get_s(key) read(key)&.to_s end |
#set_f(key, value) ⇒ Object
14 15 16 |
# File 'lib/cyclotone/state.rb', line 14 def set_f(key, value) write(key, value.to_f) end |
#set_i(key, value) ⇒ Object
18 19 20 |
# File 'lib/cyclotone/state.rb', line 18 def set_i(key, value) write(key, value.to_i) end |
#set_s(key, value) ⇒ Object
22 23 24 |
# File 'lib/cyclotone/state.rb', line 22 def set_s(key, value) write(key, value.to_s) end |