Class: Sequel::LiteralString

Inherits:
String show all
Includes:
Postgres::ArrayOpMethods, Postgres::HStoreOpMethods, Postgres::InetOpMethods, Postgres::JSONOpMethods, Postgres::PGRowOp::ExpressionMethods, Postgres::RangeOpMethods, SQL::AliasMethods, SQL::BooleanMethods, SQL::CastMethods, SQL::ComplexExpressionMethods, SQL::InequalityMethods, SQL::NumericMethods, SQL::OrderMethods, SQL::StringMethods
Defined in:
lib/sequel/sql.rb,
lib/sequel/sql.rb,
lib/sequel/extensions/pg_row_ops.rb,
lib/sequel/extensions/pg_inet_ops.rb,
lib/sequel/extensions/pg_json_ops.rb,
lib/sequel/extensions/pg_array_ops.rb,
lib/sequel/extensions/pg_range_ops.rb,
lib/sequel/extensions/pg_hstore_ops.rb

Overview

LiteralString is used to represent literal SQL expressions. A LiteralString is copied verbatim into an SQL statement. Instances of LiteralString can be created by calling Sequel.lit.

Instance Method Summary collapse

Methods included from Postgres::HStoreOpMethods

#hstore

Methods included from Postgres::RangeOpMethods

#pg_range

Methods included from Postgres::ArrayOpMethods

#pg_array

Methods included from Postgres::JSONOpMethods

#pg_json, #pg_jsonb

Methods included from Postgres::InetOpMethods

#pg_inet

Methods included from Postgres::PGRowOp::ExpressionMethods

#pg_row

Methods included from SQL::CastMethods

#cast, #cast_numeric, #cast_string

Methods included from SQL::AliasMethods

#as

Methods included from SQL::StringMethods

#ilike, #like

Methods included from SQL::NumericMethods

#+, #coerce

Methods included from SQL::BooleanMethods

#~

Methods included from SQL::ComplexExpressionMethods

#extract, #sql_boolean, #sql_number, #sql_string

Methods included from SQL::OrderMethods

#asc, #desc

Methods inherited from String

#blank?, #camelize, #classify, #constantize, #dasherize, #demodulize, #foreign_key, #humanize, inflections, #pluralize, #singularize, #tableize, #titleize, #to_date, #to_datetime, #to_sequel_time, #to_time, #underscore

Instance Method Details

#inspectObject

Show that the current string is a literal string in addition to the output.


1940
1941
1942
# File 'lib/sequel/sql.rb', line 1940

def inspect
  "#<#{self.class} #{super}>"
end

#lit(*args) ⇒ Object

Return self if no args are given, otherwise return a SQL::PlaceholderLiteralString with the current string and the given args.


1946
1947
1948
# File 'lib/sequel/sql.rb', line 1946

def lit(*args)
  args.empty? ? self : SQL::PlaceholderLiteralString.new(self, args)
end

#to_sequel_blobObject

Convert a literal string to a SQL::Blob.


1951
1952
1953
# File 'lib/sequel/sql.rb', line 1951

def to_sequel_blob
  SQL::Blob.new(self)
end