Object
class Object
Constants
- HashWithIndifferentAccess
-
Implements a hash where keys
:foo
and"foo"
are considered to be the same.rgb = ActiveSupport::HashWithIndifferentAccess.new rgb[:black] = '#000000' rgb[:black] # => '#000000' rgb['black'] # => '#000000' rgb['white'] = '#FFFFFF' rgb[:white] # => '#FFFFFF' rgb['white'] # => '#FFFFFF'
Internally symbols are mapped to strings when used as keys in the entire writing interface (calling
[]=
,merge
, etc). This mapping belongs to the public interface. For example, given:登录查看完整内容