struct SimpleHash(K, V)
Defined in:
simple_hash.crClass Method Summary
Instance Method Summary
- #[](key)
 - #[]=(key : K, value : V)
 - #[]?(key)
 - #delete(key)
 - #dup
 - #each(&block)
 - #each_key(&block)
 - #each_value(&block)
 - 
        #each_with_object(memo, &block)
        
          
Iterates the given block for each element with an arbitrary object given, and returns the initially given object.
 - #fetch(key, &block)
 - #has_key?(key)
 - #inspect(io : IO)
 - #keys
 - #object_id
 - 
        #reject(&block : K, V -> U)
        
          
Returns a new hash consisting of entries for which the block returns false.
 - 
        #reject!(&block : K, V -> U)
        
          
Equivalent to
Hash#reject, but makes modification on the current object rather that returning a new one. - 
        #select(&block : K, V -> U)
        
          
Returns a new hash consisting of entries for which the block returns true.
 - 
        #select!(&block : K, V -> U)
        
          
Equivalent to
Hash#selectbut makes modification on the current object rather that returning a new one. - #size
 - #to_s(io : IO)
 - #values
 
Instance methods inherited from struct Struct
  
  
    
      ==(other : self) : Bool
    ==, 
    
  
    
      hash : Int32
    hash, 
    
  
    
      inspect(io : IO) : Nil
    inspect, 
    
  
    
      to_s(io)
    to_s
    
  
    
  
    
  Instance methods inherited from struct Value
  
  
    
      ==(other)
    ==, 
    
  
    
      dup
    dup
    
  
    
  
    
  Instance methods inherited from class Object
  
  
    
      !=(other)
    !=, 
    
  
    
      !~(other)
    !~, 
    
  
    
      ==(other)
    ==, 
    
  
    
      ===(other)===(other : YAML::Any)
===(other : JSON::Any) ===, =~(other) =~, class class, crystal_type_id crystal_type_id, dup dup, hash hash, inspect(io : IO)
inspect inspect, itself itself, not_nil! not_nil!, tap(&block) tap, to_json to_json, to_pretty_json(io : IO)
to_pretty_json to_pretty_json, to_s
to_s(io : IO) to_s, to_yaml
to_yaml(io : IO) to_yaml, try(&block) try
Class methods inherited from class Object
  
  
    
      ==(other : Class)
    ==, 
    
  
    
      ===(other)
    ===, 
    
  
    
      cast(other) : self
    cast, 
    
  
    
      clone
    clone, 
    
  
    
      dup
    dup, 
    
  
    
      from_json(string_or_io, root : String) : selffrom_json(string_or_io) : self from_json, from_yaml(string : String) : self from_yaml, hash hash, inspect(io) inspect, name : String name, to_s(io) to_s, |(other : U.class) |
Class Method Detail
Instance Method Detail
Iterates the given block for each element with an arbitrary object given, and returns the initially given object.
evens = (1..10).each_with_object([] of Int32) { |i, a| a << i*2 }
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]Returns a new hash consisting of entries for which the block returns false.
h = {"a" => 100, "b" => 200, "c" => 300}
h.reject { |k, v| k > "a" } # => {"a" => 100}
h.reject { |k, v| v < 200 } # => {"b" => 200, "c" => 300}Equivalent to Hash#reject, but makes modification on the current object rather that returning a new one. Returns nil if no changes were made.
Returns a new hash consisting of entries for which the block returns true.
h = {"a" => 100, "b" => 200, "c" => 300}
h.select { |k, v| k > "a" } # => {"b" => 200, "c" => 300}
h.select { |k, v| v < 200 } # => {"a" => 100}Equivalent to Hash#select but makes modification on the current object rather that returning a new one. Returns nil if no changes were made