Class: MetaWhere::JoinType

Inherits:
Object
  • Object
show all
Defined in:
lib/meta_where/join_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, join_type = Arel::Nodes::InnerJoin, klass = nil) ⇒ JoinType

Returns a new instance of JoinType.



5
6
7
8
9
# File 'lib/meta_where/join_type.rb', line 5

def initialize(name, join_type = Arel::Nodes::InnerJoin, klass = nil)
  @name = name
  @join_type = join_type
  @klass = klass
end

Instance Attribute Details

#join_typeObject (readonly)

Returns the value of attribute join_type.



3
4
5
# File 'lib/meta_where/join_type.rb', line 3

def join_type
  @join_type
end

#klassObject (readonly)

Returns the value of attribute klass.



3
4
5
# File 'lib/meta_where/join_type.rb', line 3

def klass
  @klass
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/meta_where/join_type.rb', line 3

def name
  @name
end

Instance Method Details

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



11
12
13
14
15
16
# File 'lib/meta_where/join_type.rb', line 11

def ==(other)
  self.class == other.class &&
  name == other.name &&
  join_type == other.join_type &&
  klass == other.klass
end

#hashObject



20
21
22
# File 'lib/meta_where/join_type.rb', line 20

def hash
  [name, join_type, klass].hash
end

#innerObject



29
30
31
32
# File 'lib/meta_where/join_type.rb', line 29

def inner
  @join_type = Arel::Nodes::InnerJoin
  self
end

#outerObject



24
25
26
27
# File 'lib/meta_where/join_type.rb', line 24

def outer
  @join_type = Arel::Nodes::OuterJoin
  self
end

#to_symObject



39
40
41
# File 'lib/meta_where/join_type.rb', line 39

def to_sym
  self
end

#type(klass) ⇒ Object



34
35
36
37
# File 'lib/meta_where/join_type.rb', line 34

def type(klass)
  @klass = klass
  self
end