Class: Erlectricity::HashCondition
Instance Method Summary
collapse
Methods inherited from Condition
for, #initialize
Instance Method Details
#binding_for(arg) ⇒ Object
8
9
10
11
|
# File 'lib/erlectricity/conditions/hash.rb', line 8
def binding_for(arg)
flattened = arg.inject([]) { |memo, kv| memo + kv }
Hash[*flattened]
end
|
#satisfies?(arg) ⇒ Boolean
3
4
5
6
|
# File 'lib/erlectricity/conditions/hash.rb', line 3
def satisfies?(arg)
return false unless arg.class == Array
arg.all? { |x| x.class == Array && x.length == 2 }
end
|