Commit 026e6e23 by ivan Lan

Add :values_at to Harray

parent f52191e4
...@@ -34,6 +34,10 @@ module Shotengai ...@@ -34,6 +34,10 @@ module Shotengai
nil nil
end end
def values_at *keys
self.reduce([]) { |output, obj| output << obj.last if obj.first.in?(keys) }
end
def decode def decode
self.map{ |obj| { obj['key'] => obj['val'] } }.reduce(&:merge) self.map{ |obj| { obj['key'] => obj['val'] } }.reduce(&:merge)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment