Ruby hashes allow you to use arbitrary objects as keys. Since strings (for example, "id") and characters (for example, :id) are separate types of objects, a hash can have as a key both a string and a character with the same visual content without conflict:
irb(main):001:0> { :a=>1, "a"=>2 }
JavaScript, .
- ( GET POST) , Sinatra "", , . default_proc, to_s , .
:
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
[]=(key, val), .