Skip to content

Tag Archives: Ruby Hash-class

Hash#rehash() : rehash() is a Hash class method which based on the current hash value rebuilds the hash for each key. This will reindex hash… Read More
Hash#merge!() : merge!() is a Hash class method which can add the content the given hash array to the other. Entries with duplicate keys are… Read More
Hash#merge() is a Hash class method which combines two hash arrays and their content. Syntax: Hash.merge() Parameter: Hash values Return: combine two hash arrays Example… Read More
Hash#member?() is a Hash class method which checks whether the given key is present in hash is not. Syntax: Hash.member?() Parameter: Hash values Return: true… Read More
Hash#length() : length() is a Hash class method which gives number of key-value pairs in the hash. Syntax: Hash.length() Parameter: Hash values Return: number of… Read More
Hash#reject!() is a Hash class method which checks whether any changes are made in the hash array or not Syntax: Hash.reject!() Parameter: Hash values Return:… Read More
Hash#reject() is a Hash class method which returns a new hash which consists of entries for which the block returns false. Syntax: Hash.reject() Parameter: Hash… Read More
Hash#<() is a Hash class method which compares two Hash values. Syntax: Hash.<() Parameter: Hash values Return: true – if a < b otherwise return… Read More
Hash#>() is a Hash class method compares two Hash values. Syntax: Hash.>() Parameter: Hash values Return: true – if a > b otherwise return false… Read More
Hash#<=() is a Hash class method which compares two Hash values. Syntax: Hash.<=() Parameter: Hash values Return: true – if a <= b otherwise return… Read More
Hash#has_key?() is a Hash class method which checks whether the given key is present in hash. Syntax: Hash.has_key?() Parameter: Hash values Return: true – if… Read More
Hash#keys() is a Hash class method which gives an array with all the keys present in the hash. Syntax: Hash.keys() Parameter: Hash values Return: array… Read More
Hash#key?() is a Hash class method which checks whether the key corresponding to the value is present or not. Syntax: Hash.key?() Parameter: Hash values Return:… Read More
Hash#key() is a Hash class method which gives the key value corresponding to the value. If value doesn’t exist then return nil. Syntax: Hash.key() Parameter:… Read More
Hash#keep_if() is a Hash class method which only keeps those key value pair that follows the block condition. Syntax: Hash.keep_if() Parameter: Hash values block –… Read More