class SQLKnit::Needle

Public Class Methods

new() click to toggle source
# File lib/needle.rb, line 5
def initialize
  @sql_select = SQL::Select.new
  @sql_from   = SQL::From.new
end

Public Instance Methods

from(*table_names, &block) click to toggle source
# File lib/needle.rb, line 14
def from *table_names, &block
  table_names[0..-2].each {|table_name| @sql_from.add_table table_name }
  @sql_from.contextlize table_names.last, &block
end
from_statement() click to toggle source
# File lib/needle.rb, line 23
def from_statement
  @sql_from.to_statement
end
select(&block) click to toggle source
# File lib/needle.rb, line 10
def select &block
  @sql_select.instance_eval &block
end
select_statement() click to toggle source
# File lib/needle.rb, line 19
def select_statement
  @sql_select.to_statement
end