Module: Locomotive::RelationalAlgebra::Attribute::HashKeys

Included in:
Locomotive::RelationalAlgebra::Attribute
Defined in:
lib/locomotive/relational_algebra/attributes.rb

Instance Method Summary collapse

Instance Method Details

#eql?(other) ⇒ Boolean

We want to use attributes as keys for a hash-object, so we have to overwrite the eql?- and hash-method to make it work

Returns:

  • (Boolean)


137
138
139
# File 'lib/locomotive/relational_algebra/attributes.rb', line 137

def eql?(other)
  self.==(other)
end

#hashObject



142
143
144
145
146
# File 'lib/locomotive/relational_algebra/attributes.rb', line 142

def hash
  # not the best algorithm for calculating a
  # hash but it works quite well
  self.class.object_id + name.object_id
end