Class: Sequel::SQL::Constant
- Inherits:
-
GenericExpression
- Object
- Expression
- GenericExpression
- Sequel::SQL::Constant
- Defined in:
- lib/sequel/sql.rb,
lib/sequel/extensions/eval_inspect.rb
Overview
Represents constants or psuedo-constants (e.g. CURRENT_DATE
) in SQL.
Direct Known Subclasses
Constant Summary collapse
- INSPECT_LOOKUPS =
Constants to lookup in the Sequel module.
[:CURRENT_DATE, :CURRENT_TIMESTAMP, :CURRENT_TIME, :SQLTRUE, :SQLFALSE, :NULL, :NOTNULL]
Instance Attribute Summary collapse
-
#constant ⇒ Object
readonly
The underlying constant related to this object.
Instance Method Summary collapse
-
#initialize(constant) ⇒ Constant
constructor
Create a constant with the given value.
-
#inspect ⇒ Object
Reference the constant in the Sequel module if there is one that matches.
Methods included from IsDistinctFrom::Methods
Methods included from Sequel::SQLite::JSONOpMethods
#sqlite_json_op, #sqlite_jsonb_op
Methods included from Postgres::HStoreOpMethods
Methods included from Postgres::RangeOpMethods
Methods included from Postgres::ArrayOpMethods
Methods included from Postgres::JSONOpMethods
Methods included from Postgres::InetOpMethods
Methods included from Postgres::PGRowOp::ExpressionMethods
Methods included from SubscriptMethods
Methods included from StringMethods
#escaped_ilike, #escaped_like, #ilike, #like
Methods included from PatternMatchMethods
Methods included from OrderMethods
Methods included from NumericMethods
Methods included from ComplexExpressionMethods
#extract, #sql_boolean, #sql_number, #sql_string
Methods included from CastMethods
#cast, #cast_numeric, #cast_string
Methods included from BooleanMethods
Methods included from AliasMethods
Methods inherited from Expression
#==, attr_reader, #clone, #eql?, #hash, inherited
Constructor Details
#initialize(constant) ⇒ Constant
Create a constant with the given value
1296 1297 1298 1299 |
# File 'lib/sequel/sql.rb', line 1296 def initialize(constant) @constant = constant freeze end |
Instance Attribute Details
#constant ⇒ Object (readonly)
The underlying constant related to this object.
1293 1294 1295 |
# File 'lib/sequel/sql.rb', line 1293 def constant @constant end |
Instance Method Details
#inspect ⇒ Object
Reference the constant in the Sequel module if there is one that matches.
110 111 112 113 114 115 |
# File 'lib/sequel/extensions/eval_inspect.rb', line 110 def inspect INSPECT_LOOKUPS.each do |c| return "Sequel::#{c}" if Sequel.const_get(c) == self end super end |