class ProstoCache::ProstoHash

Attributes

hash[R]

Public Class Methods

new(hash = {}) click to toggle source
# File lib/prosto_cache/prosto_hash.rb, line 4
def initialize(hash = {})
  @hash = hash.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v }
end

Public Instance Methods

[](key) click to toggle source
# File lib/prosto_cache/prosto_hash.rb, line 8
def [](key)
  raise ArgumentError unless key
  hash[key.to_sym]
end
[]=(key, value) click to toggle source
# File lib/prosto_cache/prosto_hash.rb, line 13
def []=(key, value)
  raise ArgumentError unless key
  hash[key.to_sym] = value
end
keys(init = nil) click to toggle source
# File lib/prosto_cache/prosto_hash.rb, line 18
def keys(init = nil)
  @keys = @keys || init || hash.keys
end
values(init = nil) click to toggle source
# File lib/prosto_cache/prosto_hash.rb, line 22
def values(init = nil)
  @values = @values || init || hash.values
end