aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-11-23 16:24:41 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-23 16:24:41 -0800
commit76932b99d60b28f93c88c9a95873ba8524c9e370 (patch)
tree92bf234127eca9f013e6ff22903c7ff363387e5f /lib/arel/nodes
parent3e928ee400d083e7391474c61c8fcef74f0c848a (diff)
downloadrails-76932b99d60b28f93c88c9a95873ba8524c9e370.tar.gz
rails-76932b99d60b28f93c88c9a95873ba8524c9e370.tar.bz2
rails-76932b99d60b28f93c88c9a95873ba8524c9e370.zip
adding a "not" factory method for creating Not nodes
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r--lib/arel/nodes/node.rb7
-rw-r--r--lib/arel/nodes/not.rb11
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/arel/nodes/node.rb b/lib/arel/nodes/node.rb
index 43bad19488..841b954db9 100644
--- a/lib/arel/nodes/node.rb
+++ b/lib/arel/nodes/node.rb
@@ -4,6 +4,13 @@ module Arel
# Abstract base class for all AST nodes
class Node
###
+ # Factory method to create a Nodes::Not node that has the recipient of
+ # the caller as a child.
+ def not
+ Nodes::Not.new self
+ end
+
+ ###
# Factory method to create a Nodes::Grouping node that has an Nodes::Or
# node as a child.
def or right
diff --git a/lib/arel/nodes/not.rb b/lib/arel/nodes/not.rb
new file mode 100644
index 0000000000..d463ae9d08
--- /dev/null
+++ b/lib/arel/nodes/not.rb
@@ -0,0 +1,11 @@
+module Arel
+ module Nodes
+ class Not < Arel::Nodes::Node
+ attr_reader :expr
+
+ def initialize expr
+ @expr = expr
+ end
+ end
+ end
+end