Class: SysPref::FakeStore

Inherits:
Object
  • Object
show all
Defined in:
lib/iated/sys_pref.rb

Overview

An in-memory replacement for JavaStore

Instance Method Summary collapse

Constructor Details

#initializeFakeStore

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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (nil)


55
56
57
# File 'lib/iated/sys_pref.rb', line 55

def putInt key, value
  @store[key.to_s] = value.to_i
end