Module: Moneta::Defaults

Instance Method Summary collapse

Instance Method Details

#[]=(key, value) ⇒ Object



12
13
14
# File 'lib/moneta.rb', line 12

def []=(key, value)
  store(key, value)
end

#fetch(key, value = nil) ⇒ Object



5
6
7
8
9
10
# File 'lib/moneta.rb', line 5

def fetch(key, value = nil, *)
  self[key] || begin
    value ||= block_given? ? yield(key) : default
    self[key] || value
  end
end