Class: OnWhereBuilder
- Inherits:
-
WhereBuilder
- Object
- WhereBuilder
- OnWhereBuilder
- Defined in:
- lib/on_where_builder.rb
Instance Attribute Summary
Attributes inherited from WhereBuilder
Instance Method Summary collapse
-
#to_sql ⇒ Object
call-seq: on_where.to_sql -> a_string.
Methods inherited from WhereBuilder
#add_clause, #add_condition, #add_parenthesis_condition, #equal, #exists, #greater_than, #greater_than_or_equal, #initialize, #is_in, #is_not_in, #is_not_null, #less_than, #less_than_or_equal, #like, #not_equal, #not_exists
Constructor Details
This class inherits a constructor from WhereBuilder
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class WhereBuilder
Instance Method Details
#to_sql ⇒ Object
call-seq: on_where.to_sql -> a_string
Returns a string by collecting all the conditions and joins them with ‘ and ’.
OnWhereBuilder.new [] do
equal :column1, 10
equal :column2, 'book'
end.to_sql #=> " on column1 = 10 and column2 = 'book'"
11 12 13 |
# File 'lib/on_where_builder.rb', line 11 def to_sql " on #{sql_parts.join(' and ')}" end |