Class: HashDealer::Hash

Inherits:
Hash show all
Defined in:
lib/hash.rb

Instance Method Summary collapse

Methods inherited from Hash

#matcher, #pathify_strings

Constructor Details

#initialize(optional_attributes = []) ⇒ Hash

Returns a new instance of Hash.



4
5
6
# File 'lib/hash.rb', line 4

def initialize(optional_attributes = [])
  @optional_attributes = optional_attributes
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'lib/hash.rb', line 8

def eql?(other)
  self_for_comparison = self.remove_optional_keys(self)
  other_for_comparison = self.remove_optional_keys(other)

  self_for_comparison.eql?(other_for_comparison)
end

#to_hashObject



15
16
17
18
19
20
21
# File 'lib/hash.rb', line 15

def to_hash
  ret = ::Hash.new
  self.each_pair do |k,v|
    ret[k] = v
  end
  ret
end