Commit 91aac217 by ivan Lan

Improve Shotengai::Harray

parent f672f229
module Shotengai
class Harray < Array
def keys
self.map { |obj| obj['key'] || obj[:ket] }
self.map { |obj| obj['key'] }
end
def vals
self.map { |obj| obj['key'] || obj[:ket] }
self.map { |obj| obj['key'] }
end
def val_at key
self.bsearch { |obj| obj['key'].eql?(key) }&.[]('val')
end
end
end
\ No newline at end of file
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