Class: Cyclotone::State

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cyclotone/state.rb

Instance Method Summary collapse

Constructor Details

#initializeState

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