Class: SysPref::FakeStore
- Inherits:
-
Object
- Object
- SysPref::FakeStore
- Defined in:
- lib/iated/sys_pref.rb
Overview
An in-memory replacement for JavaStore
Instance Method Summary collapse
- #get(key, default) ⇒ String
- #getInt(key, default) ⇒ Integer
-
#initialize ⇒ FakeStore
constructor
A new instance of FakeStore.
- #put(key, value) ⇒ nil
- #putInt(key, value) ⇒ nil
Constructor Details
#initialize ⇒ FakeStore
Returns a new instance of FakeStore.
47 48 49 |
# File 'lib/iated/sys_pref.rb', line 47 def initialize @store = {} end |
Instance Method Details
#get(key, default) ⇒ String
59 60 61 |
# File 'lib/iated/sys_pref.rb', line 59 def get key, default (@store[key.to_s] || default).to_s end |
#getInt(key, default) ⇒ Integer
51 52 53 |
# File 'lib/iated/sys_pref.rb', line 51 def getInt key, default (@store[key.to_s] || default).to_i end |
#put(key, value) ⇒ nil
63 64 65 |
# File 'lib/iated/sys_pref.rb', line 63 def put key, value @store[key.to_s] = value.to_s end |
#putInt(key, value) ⇒ nil
55 56 57 |
# File 'lib/iated/sys_pref.rb', line 55 def putInt key, value @store[key.to_s] = value.to_i end |