module Rebel

Constants

SQL

Public Class Methods

SQL(options = {}, &block) click to toggle source
# File lib/rebel/sql.rb, line 391
def self.SQL(options = {}, &block)
  sql = const_defined?(:SQL) && options.empty? ? SQL : Module.new do
    @identifier_quote = options[:identifier_quote] || '"'
    @string_quote = options[:string_quote] || "'"
    @escaped_string_quote = options[:escaped_string_quote] || "''"
    @escaped_string_backslash = options[:escaped_string_backslash]
    @true_literal = options[:true_literal] || 'TRUE'
    @false_literal = options[:false_literal] || 'FALSE'

    extend Rebel::SQLB
    include Rebel::SQLQ

    def self.name(name = nil)
      return "Rebel::SQL" if name.nil?
      super
    end

    def self.inspect
      "#<Rebel::SQL(#{instance_variables.map { |k| "#{k.to_s.sub(/^@/, '')}: #{instance_variable_get(k).inspect}" }.join(', ')})>"
    end
  end

  return sql.instance_eval(&block) unless block.nil?

  sql
end
inspect() click to toggle source
# File lib/rebel/sql.rb, line 408
def self.inspect
  "#<Rebel::SQL(#{instance_variables.map { |k| "#{k.to_s.sub(/^@/, '')}: #{instance_variable_get(k).inspect}" }.join(', ')})>"
end
name(name = nil) click to toggle source
Calls superclass method
# File lib/rebel/sql.rb, line 403
def self.name(name = nil)
  return "Rebel::SQL" if name.nil?
  super
end