Class: Sequel::SQL::Blob
- Includes:
- AliasMethods, CastMethods
- Defined in:
- lib/sequel/sql.rb
Overview
Blob
is used to represent binary data in the Ruby environment that is stored as a blob type in the database. Sequel represents binary data as a Blob object because most database engines require binary data to be escaped differently than regular strings.
Instance Method Summary collapse
-
#inspect ⇒ Object
Return a string showing that this is a blob, the size, and the some or all of the content, depending on the size.
-
#lit(*args) ⇒ Object
Return a LiteralString with the same content if no args are given, otherwise return a SQL::PlaceholderLiteralString with the current string and the given args.
-
#to_sequel_blob ⇒ Object
Returns
self
, since it is already a blob.
Methods included from CastMethods
#cast, #cast_numeric, #cast_string
Methods included from AliasMethods
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
#inspect ⇒ Object
Return a string showing that this is a blob, the size, and the some or all of the content, depending on the size.
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
# File 'lib/sequel/sql.rb', line 1041 def inspect size = length content = if size > 20 "start=#{self[0...10].to_s.inspect} end=#{self[-10..-1].to_s.inspect}" else "content=#{super}" end "#<#{self.class}:0x#{"%x" % object_id} bytes=#{size} #{content}>" end |
#lit(*args) ⇒ Object
Return a LiteralString with the same content if no args are given, otherwise return a SQL::PlaceholderLiteralString with the current string and the given args.
1035 1036 1037 |
# File 'lib/sequel/sql.rb', line 1035 def lit(*args) args.empty? ? LiteralString.new(self) : SQL::PlaceholderLiteralString.new(self, args) end |
#to_sequel_blob ⇒ Object
Returns self
, since it is already a blob.
1054 1055 1056 |
# File 'lib/sequel/sql.rb', line 1054 def to_sequel_blob self end |