Sha256: a0f81719bab69f88c603dbce802e91d439291696744030e5536564e2102af0ce

Contents?: true

Size: 551 Bytes

Versions: 2

Compression:

Stored size: 551 Bytes

Contents

module Adapter
  module Defaults
    def fetch(key, default_attributes=nil)
      read(key) || begin
        if block_given?
          yield(key)
        else
          default_attributes
        end
      end
    end

    def read_multiple(*keys)
      result = {}
      keys.each { |key| result[key_for(key)] = read(key) }
      result
    end

    def key?(key)
      !read(key).nil?
    end

    def key_for(key)
      key
    end

    def encode(attributes)
      attributes
    end

    def decode(attributes)
      attributes
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adapter-0.6.3 lib/adapter/defaults.rb
adapter-0.6.2 lib/adapter/defaults.rb