From 4127484bc172900f0817d6adda666a1397ff038e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 12 Aug 2010 15:22:26 -0700 Subject: adding first node --- lib/arel/attributes/attribute.rb | 9 ++++++--- lib/arel/nodes.rb | 1 + lib/arel/nodes/equality.rb | 12 ++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 lib/arel/nodes.rb create mode 100644 lib/arel/nodes/equality.rb (limited to 'lib/arel') diff --git a/lib/arel/attributes/attribute.rb b/lib/arel/attributes/attribute.rb index b83a32bee7..fdc64d62e0 100644 --- a/lib/arel/attributes/attribute.rb +++ b/lib/arel/attributes/attribute.rb @@ -1,13 +1,16 @@ module Arel module Attributes class Attribute < Struct.new :relation, :name, :column + def eq other + Nodes::Equality.new self, other + end end - class String < Attribute; end - class Time < Attribute; end + class String < Attribute; end + class Time < Attribute; end class Boolean < Attribute; end class Decimal < Attribute; end - class Float < Attribute; end + class Float < Attribute; end class Integer < Attribute; end end end diff --git a/lib/arel/nodes.rb b/lib/arel/nodes.rb new file mode 100644 index 0000000000..855d8cf236 --- /dev/null +++ b/lib/arel/nodes.rb @@ -0,0 +1 @@ +require 'arel/nodes/equality' diff --git a/lib/arel/nodes/equality.rb b/lib/arel/nodes/equality.rb new file mode 100644 index 0000000000..11383b1d89 --- /dev/null +++ b/lib/arel/nodes/equality.rb @@ -0,0 +1,12 @@ +module Arel + module Nodes + class Equality + attr_accessor :left, :right + + def initialize left, right + @left = left + @right = right + end + end + end +end -- cgit v1.2.3