class Arel::Nodes::Extract - arel-4.0.2 Documentation

# class Arel::Nodes::Extract

### Attributes

alias[RW]
field[RW]

### Public Class Methods

new(expr, field, aliaz = nil) click to toggle source
Calls superclass method Arel::Nodes::Unary.new

    # File lib/arel/nodes/extract.rb, line 11
    def initialize expr, field, aliaz = nil
      super(expr)
      @field = field
      @alias = aliaz && SqlLiteral.new(aliaz)
    end

### Public Instance Methods

==(other)
Alias for: eql?
as(aliaz) click to toggle source

    # File lib/arel/nodes/extract.rb, line 17
    def as aliaz
      self.alias = SqlLiteral.new(aliaz)
      self
    end

eql?(other) click to toggle source
Calls superclass method Arel::Nodes::Unary#eql?

    # File lib/arel/nodes/extract.rb, line 26
    def eql? other
      super &&
        self.field == other.field &&
        self.alias == other.alias
    end

Also aliased as: ==
hash() click to toggle source
Calls superclass method Arel::Nodes::Unary#hash

    # File lib/arel/nodes/extract.rb, line 22
    def hash
      super ^ [@field, @alias].hash
    end