class Sequel::SQL::Blob

  1. lib/sequel/sql.rb
Superclass: String

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.

Methods

Public Instance

  1. inspect
  2. lit
  3. to_sequel_blob

Public Instance methods

inspect()

Return a string showing that this is a blob, the size, and the some or all of the content, depending on the size.

[show source]
     # File lib/sequel/sql.rb
1038 def inspect
1039   size = length
1040 
1041   content = if size > 20
1042     "start=#{self[0...10].to_s.inspect} end=#{self[-10..-1].to_s.inspect}"
1043   else
1044     "content=#{super}"
1045   end
1046 
1047   "#<#{self.class}:0x#{"%x" % object_id} bytes=#{size} #{content}>"
1048 end
lit(*args)

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.

[show source]
     # File lib/sequel/sql.rb
1032 def lit(*args)
1033   args.empty? ? LiteralString.new(self) : SQL::PlaceholderLiteralString.new(self, args)
1034 end
to_sequel_blob()

Returns self, since it is already a blob.

[show source]
     # File lib/sequel/sql.rb
1051 def to_sequel_blob
1052   self
1053 end