class TZFormater::Common::PstoreAdapter

Constants

READ_ONLY

Public Class Methods

new(filename) click to toggle source
# File lib/tzformater/common/pstore_adapter.rb, line 8
def initialize(filename)
  raise PStore::Error.new("Cannot find such file -- " << filename) unless File.exist?(filename)
  @file = PStore.new(filename)
end

Public Instance Methods

get_all(type) click to toggle source
# File lib/tzformater/common/pstore_adapter.rb, line 21
def get_all(type)
  list = {}
  @file.transaction(READ_ONLY) do
    list = @file.fetch(type, {})
  end
  list
end
get_all_keys(type) click to toggle source
# File lib/tzformater/common/pstore_adapter.rb, line 17
def get_all_keys(type)
  get_all(type).keys
end
get_by(type, timezone) click to toggle source
# File lib/tzformater/common/pstore_adapter.rb, line 13
def get_by(type, timezone)
  get_all(type).fetch(timezone, nil)
end