Module: Setup::Store

Constant Summary collapse

DEFAULT_STORE_PATH =
"byetypo_dictionary.pstore"
SEVEN_DAYS =
604800

Instance Method Summary collapse

Instance Method Details

#staled_store?Boolean

By default we update the store every week. TODO: Make it configurable

Returns:

  • (Boolean)


16
17
18
19
20
# File 'lib/pry-byetypo/setup/store.rb', line 16

def staled_store?
  return true if store["synced_at"].nil?

  (store["synced_at"] + SEVEN_DAYS) <= Time.now
end

#storeObject



6
7
8
# File 'lib/pry-byetypo/setup/store.rb', line 6

def store
  @store ||= PStore.new(store_path)
end

#store_pathObject



10
11
12
# File 'lib/pry-byetypo/setup/store.rb', line 10

def store_path
  ENV["BYETYPO_STORE_PATH"] || DEFAULT_STORE_PATH
end