class TenderHash::ScopeRule
Public Class Methods
new(key, &block)
click to toggle source
# File lib/tender_hash/scope_rule.rb, line 4 def initialize(key, &block) raise ArgumentError unless block_given? @key = key @block = block end
Public Instance Methods
apply(old, new, options={})
click to toggle source
# File lib/tender_hash/scope_rule.rb, line 14 def apply(old, new, options={}) map.source = old map.instance_exec(&@block) new[@key] = map.to_h end
map()
click to toggle source
# File lib/tender_hash/scope_rule.rb, line 10 def map @map ||= Map.new end