module Ronin::SQL::Emittable

Allows an object to be converted to raw SQL.

@api public

Public Instance Methods

emitter(options={}) click to toggle source

Creates a new emitter.

@param [Hash] options

Additional options for {Emitter#initialize}.

@api private

# File lib/ronin/sql/emittable.rb, line 41
def emitter(options={})
  Emitter.new(options)
end
inspect() click to toggle source

Inspects the object.

@return [String]

The inspected object.
# File lib/ronin/sql/emittable.rb, line 83
def inspect
  "#<#{self.class}: #{to_sql}>"
end
to_s() click to toggle source

@see to_sql

# File lib/ronin/sql/emittable.rb, line 73
def to_s
  to_sql
end
to_sql(options={}) click to toggle source

The default β€˜to_sql` method.

@param [Hash] options

Additional options for {#emitter}.

@option options [:lower, :upper, :random, nil] :case

Case for keywords.

@option options [String] :space (β€˜ ’)

String to use for white-space.

@option options [:single, :double] :quotes (:single)

Type of quotes to use for Strings.

@return [String]

The raw SQL.

@raise [ArgumentError]

Could not emit an unknown SQL object.
# File lib/ronin/sql/emittable.rb, line 66
def to_sql(options={})
  emitter(options).emit(self)
end