Class: SQLKnit::Needle
- Inherits:
-
Object
- Object
- SQLKnit::Needle
- Defined in:
- lib/needle.rb
Instance Method Summary collapse
- #from(*table_names, &block) ⇒ Object
- #from_statement ⇒ Object
-
#initialize ⇒ Needle
constructor
A new instance of Needle.
- #select(&block) ⇒ Object
- #select_statement ⇒ Object
Constructor Details
Instance Method Details
#from(*table_names, &block) ⇒ Object
14 15 16 17 |
# 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 ⇒ Object
23 24 25 |
# File 'lib/needle.rb', line 23 def from_statement @sql_from.to_statement end |
#select(&block) ⇒ Object
10 11 12 |
# File 'lib/needle.rb', line 10 def select &block @sql_select.instance_eval &block end |
#select_statement ⇒ Object
19 20 21 |
# File 'lib/needle.rb', line 19 def select_statement @sql_select.to_statement end |