aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r--lib/arel/nodes/delete_statement.rb14
-rw-r--r--lib/arel/nodes/lock.rb2
-rw-r--r--lib/arel/nodes/not.rb7
-rw-r--r--lib/arel/nodes/on.rb7
-rw-r--r--lib/arel/nodes/table_alias.rb10
-rw-r--r--lib/arel/nodes/unqualified_column.rb13
-rw-r--r--lib/arel/nodes/values.rb10
7 files changed, 25 insertions, 38 deletions
diff --git a/lib/arel/nodes/delete_statement.rb b/lib/arel/nodes/delete_statement.rb
index 610d69e460..3bac8225ec 100644
--- a/lib/arel/nodes/delete_statement.rb
+++ b/lib/arel/nodes/delete_statement.rb
@@ -1,16 +1,18 @@
module Arel
module Nodes
- class DeleteStatement
- attr_accessor :relation, :wheres
+ class DeleteStatement < Arel::Nodes::Binary
+ alias :relation :left
+ alias :relation= :left=
+ alias :wheres :right
+ alias :wheres= :right=
- def initialize
- @from = nil
- @wheres = []
+ def initialize relation = nil, wheres = []
+ super
end
def initialize_copy other
super
- @wheres = @wheres.clone
+ @right = @right.clone
end
end
end
diff --git a/lib/arel/nodes/lock.rb b/lib/arel/nodes/lock.rb
index 3c7a72273f..e5fb258e26 100644
--- a/lib/arel/nodes/lock.rb
+++ b/lib/arel/nodes/lock.rb
@@ -1,6 +1,6 @@
module Arel
module Nodes
- class Lock
+ class Lock < Arel::Nodes::Node
end
end
end
diff --git a/lib/arel/nodes/not.rb b/lib/arel/nodes/not.rb
index d463ae9d08..de138435bb 100644
--- a/lib/arel/nodes/not.rb
+++ b/lib/arel/nodes/not.rb
@@ -1,11 +1,6 @@
module Arel
module Nodes
- class Not < Arel::Nodes::Node
- attr_reader :expr
-
- def initialize expr
- @expr = expr
- end
+ class Not < Arel::Nodes::Unary
end
end
end
diff --git a/lib/arel/nodes/on.rb b/lib/arel/nodes/on.rb
index 4cc76b70db..953d64f9f1 100644
--- a/lib/arel/nodes/on.rb
+++ b/lib/arel/nodes/on.rb
@@ -1,11 +1,6 @@
module Arel
module Nodes
- class On
- attr_accessor :expr
-
- def initialize expr
- @expr = expr
- end
+ class On < Arel::Nodes::Unary
end
end
end
diff --git a/lib/arel/nodes/table_alias.rb b/lib/arel/nodes/table_alias.rb
index 60da7b19f3..723b025883 100644
--- a/lib/arel/nodes/table_alias.rb
+++ b/lib/arel/nodes/table_alias.rb
@@ -1,14 +1,10 @@
module Arel
module Nodes
- class TableAlias
- attr_reader :name, :relation
+ class TableAlias < Arel::Nodes::Binary
+ alias :name :left
+ alias :relation :right
alias :table_alias :name
- def initialize name, relation
- @name = name
- @relation = relation
- end
-
def [] name
Attribute.new self, name
end
diff --git a/lib/arel/nodes/unqualified_column.rb b/lib/arel/nodes/unqualified_column.rb
index 9882cb08e2..f7ba653c11 100644
--- a/lib/arel/nodes/unqualified_column.rb
+++ b/lib/arel/nodes/unqualified_column.rb
@@ -1,18 +1,15 @@
module Arel
module Nodes
- class UnqualifiedColumn
- attr_accessor :attribute
-
- def initialize attribute
- @attribute = attribute
- end
+ class UnqualifiedColumn < Arel::Nodes::Unary
+ alias :attribute :expr
+ alias :attribute= :expr=
def column
- @attribute.column
+ @expr.column
end
def name
- @attribute.name
+ @expr.name
end
end
end
diff --git a/lib/arel/nodes/values.rb b/lib/arel/nodes/values.rb
index 4c7ca76360..814e843dab 100644
--- a/lib/arel/nodes/values.rb
+++ b/lib/arel/nodes/values.rb
@@ -1,11 +1,13 @@
module Arel
module Nodes
- class Values
- attr_accessor :expressions, :columns
+ class Values < Arel::Nodes::Binary
+ alias :expressions :left
+ alias :expressions= :left=
+ alias :columns :right
+ alias :columns= :right=
def initialize exprs, columns = []
- @expressions = exprs
- @columns = columns
+ super
end
end
end