diff options
Diffstat (limited to 'activerecord/lib/arel/nodes/extract.rb')
-rw-r--r-- | activerecord/lib/arel/nodes/extract.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/lib/arel/nodes/extract.rb b/activerecord/lib/arel/nodes/extract.rb new file mode 100644 index 0000000000..fdf3004c6a --- /dev/null +++ b/activerecord/lib/arel/nodes/extract.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true +module Arel + module Nodes + class Extract < Arel::Nodes::Unary + attr_accessor :field + + def initialize expr, field + super(expr) + @field = field + end + + def hash + super ^ @field.hash + end + + def eql? other + super && + self.field == other.field + end + alias :== :eql? + end + end +end |