Class: Arel::Nodes::And

Inherits:
Node
  • Object
show all
Defined in:
lib/arel/nodes/and.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#and, #each, #not, #or, #to_sql

Methods included from FactoryMethods

#create_and, #create_join, #create_on, #create_string_join, #create_table_alias, #grouping, #lower

Constructor Details

#initialize(children, right = nil) ⇒ And

Returns a new instance of And.



6
7
8
9
10
11
12
# File 'lib/arel/nodes/and.rb', line 6

def initialize children, right = nil
  unless Array === children
    warn "(#{caller.first}) AND nodes should be created with a list"
    children = [children, right]
  end
  @children = children
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



4
5
6
# File 'lib/arel/nodes/and.rb', line 4

def children
  @children
end

Instance Method Details

#leftObject



14
15
16
# File 'lib/arel/nodes/and.rb', line 14

def left
  children.first
end

#rightObject



18
19
20
# File 'lib/arel/nodes/and.rb', line 18

def right
  children[1]
end