Class Sequel::SQL::Expression
In: lib/sequel/sql.rb
Parent: Object

Base class for all SQL fragments

Methods

==   attr_reader   comparison_attrs   eql?   hash   lit   sql_literal  

Public Class methods

all instance variables declared to be readers are to be used for comparison.

[Source]

    # File lib/sequel/sql.rb, line 54
54:       def self.attr_reader(*args)
55:         super
56:         comparison_attrs.concat args
57:       end

[Source]

    # File lib/sequel/sql.rb, line 59
59:       def self.comparison_attrs
60:         @comparison_attrs ||= self == Expression ? [] : superclass.comparison_attrs.clone
61:       end

Public Instance methods

Alias of eql?

[Source]

    # File lib/sequel/sql.rb, line 72
72:       def ==(other)
73:         eql?(other)
74:       end

Returns true if the receiver is the same expression as the the other expression.

[Source]

    # File lib/sequel/sql.rb, line 78
78:       def eql?(other)
79:         other.is_a?(self.class) && !self.class.comparison_attrs.find {|a| send(a) != other.send(a)}
80:       end

Make sure that the hash value is the same if the attributes are the same.

[Source]

    # File lib/sequel/sql.rb, line 83
83:       def hash
84:         ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash
85:       end

Returns self, because SQL::Expression already acts like LiteralString.

[Source]

    # File lib/sequel/sql.rb, line 89
89:       def lit
90:         self
91:       end

Alias of to_s

[Source]

    # File lib/sequel/sql.rb, line 94
94:       def sql_literal(ds)
95:         to_s(ds)
96:       end

[Validate]