Sha256: 5ddefc47b7d31b555f3b57fc488980cf26bcc672048d471e17b91b57437d441e

Contents?: true

Size: 471 Bytes

Versions: 7

Compression:

Stored size: 471 Bytes

Contents

module Setup
  module Store
    DEFAULT_STORE_PATH = "byetypo_dictionary.pstore"
    SEVEN_DAYS = 604800

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

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

    # By default we update the store every week.
    # TODO: Make it configurable
    def staled_store?
      return true if store["synced_at"].nil?

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pry-byetypo-1.3.5 lib/pry-byetypo/setup/store.rb
pry-byetypo-1.3.4 lib/pry-byetypo/setup/store.rb
pry-byetypo-1.3.3 lib/pry-byetypo/setup/store.rb
pry-byetypo-1.3.2 lib/pry-byetypo/setup/store.rb
pry-byetypo-1.3.1 lib/pry-byetypo/setup/store.rb
pry-byetypo-1.3.0 lib/pry-byetypo/setup/store.rb
pry-byetypo-1.2.0 lib/pry-byetypo/setup/store.rb