Class: SymbolHash
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: 
          self,
           ::Hash | |
| Instance Chain: 
          self,
           ::Hash | |
| Inherits: | Hash 
 | 
| Defined in: | lib/yard/core_ext/symbol_hash.rb | 
Overview
Class Method Summary
- .[](hash) ⇒ SymbolHash
- 
    
      .new(symbolize_value = true)  ⇒ SymbolHash 
    
    constructor
    Creates a new SymbolHashobject.
::Hash - Inherited
| .[] | Alias for Hash.create. | 
| .create, | |
| .create_186 | Alias for Hash.[]. | 
Instance Method Summary
- 
    
      #[](key)  ⇒ Object 
    
    Accessed a symbolized key. 
- 
    
      #[]=(key, value)  
    
    Assigns a value to a symbolized key. 
- 
    
      #delete(key)  ⇒ void 
    
    Deleted a key and value associated with it. 
- 
    
      #has_key?(key)  
    
    Alias for #key?. 
- 
    
      #key?(key)  ⇒ Boolean 
      (also: #has_key?)
    
    Tests if a symbolized key exists. 
- 
    
      #merge(hash)  ⇒ SymbolHash 
    
    Merges the contents of another hash into a new SymbolHashobject.
- 
    
      #merge!(hash)  
    
    Alias for #update. 
- 
    
      #update(hash)  ⇒ SymbolHash 
      (also: #merge!)
    
    Updates the object with the contents of another ::Hashobject.
Constructor Details
    .new(symbolize_value = true)  ⇒ SymbolHash 
  
Creates a new SymbolHash object
# File 'lib/yard/core_ext/symbol_hash.rb', line 9
def initialize(symbolize_value = true) @symbolize_value = symbolize_value end
Class Method Details
    
      .[](hash)  ⇒ SymbolHash 
      .[](*list)  ⇒ SymbolHash 
    
  
SymbolHash 
      .[](*list)  ⇒ SymbolHash 
    Instance Method Details
    #[](key)  ⇒ Object 
  
Accessed a symbolized key
# File 'lib/yard/core_ext/symbol_hash.rb', line 49
def [](key) super(key.to_sym) end
#[]=(key, value)
Assigns a value to a symbolized key
# File 'lib/yard/core_ext/symbol_hash.rb', line 42
def []=(key, value) super(key.to_sym, value.instance_of?(String) && @symbolize_value ? value.to_sym : value) end
    #delete(key)  ⇒ void 
  
This method returns an undefined value.
Deleted a key and value associated with it
# File 'lib/yard/core_ext/symbol_hash.rb', line 54
def delete(key) super(key.to_sym) end
#has_key?(key)
Alias for #key?.
# File 'lib/yard/core_ext/symbol_hash.rb', line 60
alias has_key? key?
    #key?(key)  ⇒ Boolean 
    Also known as: #has_key?
  
Tests if a symbolized key exists
# File 'lib/yard/core_ext/symbol_hash.rb', line 59
def key?(key) super(key.to_sym) end
    #merge(hash)  ⇒ SymbolHash 
  
Merges the contents of another hash into a new SymbolHash object
# File 'lib/yard/core_ext/symbol_hash.rb', line 74
def merge(hash) dup.merge!(hash) end
#merge!(hash)
Alias for #update.
# File 'lib/yard/core_ext/symbol_hash.rb', line 68
alias merge! update
    #update(hash)  ⇒ SymbolHash 
    Also known as: #merge!
  
Updates the object with the contents of another ::Hash object.
This method modifies the original SymbolHash object
# File 'lib/yard/core_ext/symbol_hash.rb', line 67
def update(hash) hash.each {|k, v| self[k] = v }; self end