Skip to content

Tag Archives: Ruby Hash-class

Hash#flatten() is a Hash class method which returns the one-dimensional flattening hash array. Syntax: Hash.flatten() Parameter: Hash values Return: one-dimensional flattening hash array Example #1… Read More
Hash#to_h() is a Hash class method which returns the self – hash representation of the hash Syntax: Hash.to_h() Parameter: Hash values Return: self object Example… Read More
Hash#to_a() is a Hash class method which gives a nested array of the key-value pair. Syntax: Hash.to_a() Parameter: Hash values Return: array representation of the… Read More
Hash#store() is a Hash class method which returns an add on value with the key given by the key-value argument. Syntax: Hash.store() Parameter: Hash values… Read More
Hash#size() is a Hash class method which returns the count of key-value pair in the hash. Syntax: Hash.size() Parameter: Hash values Return: count of key-value… Read More
Hash#shift() is a Hash class method which removes a key-value pair from hash and then it returns these value as two-item array. Syntax: Hash.shift() Parameter:… Read More
Hash#to_hash() is a Hash class method which returns the self – hash representation of the hash. Syntax: Hash.to_hash() Parameter: Hash values Return: self object Example… Read More
Hash#values_at() is a Hash class method which returns the array containing the values corresponding to keys. Syntax: Hash.values_at() Parameter: Hash values_at Return: array containing the… Read More
Hash#value?() is a Hash class method which checks whether the argumented ‘value’ is presaent in the array or not. Syntax: Hash.value?() Parameter: Hash value? Return:… Read More
Hash#values() is a Hash class method which returns the values present in the hash. Syntax: Hash.values() Parameter: Hash values Return: hash values Example #1 :… Read More
Hash#compare_by_identity () is an Hash class method which compares the hash key with its identity and consider exact same objects as same keys. Syntax: Hash.compare_by_identity… Read More
Hash#to_s() is a Hash class method which gives the string representation of the hash. Syntax: Hash.to_s() Parameter: Hash values Return: string representation of the hash.… Read More
Hash#to_proc() : to_proc() is a Hash class method which returns a Proc which maps ‘keys’ value to ‘value’ value. Syntax: Hash.to_proc() Parameter: Hash values Return:… Read More
Hash#select!() is a Hash class method which checks whether the array from the hash ius present based on the block condition. Syntax: Hash.select!() Parameter: Hash… Read More
Hash#select() : select() is a Hash class method which finds the array from the hash based on the block condition. Syntax: Hash.select() Parameter: Hash values… Read More