class FlowdockNotifications::SimpleStore

Public Class Methods

new() click to toggle source
# File lib/flowdock-notifications/simple_store.rb, line 4
def initialize
  if File.exists?(temp_filename) && File.size(temp_filename) > 0
    @store = JSON.parse(IO.read(temp_filename))
  else
    @store = {}
  end
end

Public Instance Methods

get(variable) click to toggle source
# File lib/flowdock-notifications/simple_store.rb, line 12
def get(variable)
  @store[variable]
end
set(variable, value) click to toggle source
# File lib/flowdock-notifications/simple_store.rb, line 16
def set(variable, value)
  @store[variable] = value
  File.open(temp_filename, "w") { |f| f.write(@store.to_json) }
end

Private Instance Methods

temp_filename() click to toggle source
# File lib/flowdock-notifications/simple_store.rb, line 22
def temp_filename
   "#{Dir.tmpdir}/flowdock-notifications.json"
end