Class: Polyamorous::Join

Inherits:
Object
  • Object
show all
Defined in:
lib/polyamorous/join.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type = Arel::InnerJoin, klass = nil) ⇒ Join



6
7
8
9
10
# File 'lib/polyamorous/join.rb', line 6

def initialize(name, type = Arel::InnerJoin, klass = nil)
  @name = name
  @type = convert_to_arel_join_type(type)
  @klass = convert_to_class(klass) if klass
end

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



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

def klass
  @klass
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/polyamorous/join.rb', line 3

def name
  @name
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==



24
25
26
27
28
29
# File 'lib/polyamorous/join.rb', line 24

def eql?(other)
  self.class == other.class &&
  self.name  == other.name &&
  self.type  == other.type &&
  self.klass == other.klass
end

#hashObject



20
21
22
# File 'lib/polyamorous/join.rb', line 20

def hash
  [@name, @type, @klass].hash
end