Class: SysPref::JavaStore

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

Overview

Wrapper around Java’s ‘java.util.prefs.Preferences`

Instance Method Summary collapse

Constructor Details

#initializeJavaStore

Returns a new instance of JavaStore.



22
23
24
25
# File 'lib/iated/sys_pref.rb', line 22

def initialize
  super
  @store = java.util.prefs.Preferences.userNodeForPackage(self.getClass)
end

Instance Method Details

#get(key, default) ⇒ String

Returns:

  • (String)


35
36
37
# File 'lib/iated/sys_pref.rb', line 35

def get key, default
  @store.get key.to_s, default.to_s
end

#getInt(key, default) ⇒ Integer

Returns:

  • (Integer)


27
28
29
# File 'lib/iated/sys_pref.rb', line 27

def getInt key, default
  @store.getInt key.to_s, default.to_i
end

#put(key, value) ⇒ nil

Returns:

  • (nil)


39
40
41
# File 'lib/iated/sys_pref.rb', line 39

def put key, value
  @store.put key.to_s, value.to_s
end

#putInt(key, value) ⇒ nil

Returns:

  • (nil)


31
32
33
# File 'lib/iated/sys_pref.rb', line 31

def putInt key, value
  @store.putInt key.to_s, value.to_i
end