module Baha::Refinements

Public Instance Methods

[](key) click to toggle source

Allow hash to use symbol keys or string keys

Calls superclass method
# File lib/baha/refinements.rb, line 4
def [](key)
  super(key.to_s) || super(key.to_sym)
end
pick(keys,default = nil) click to toggle source

Pick the first key that exists in the hash If none of them exist, return the default

# File lib/baha/refinements.rb, line 9
def pick(keys,default = nil)
  k = keys.find { |x| self.has_key?(x) }
  if not k.nil?
    self[k]
  else
    default
  end
end