Class: F
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
Returns the value of attribute attr_name.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#operand ⇒ Object
Returns the value of attribute operand.
-
#operator ⇒ Object
Returns the value of attribute operator.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(attr_name) ⇒ F
constructor
A new instance of F.
- #to_sql(formatter = nil) ⇒ Object
Constructor Details
#initialize(attr_name) ⇒ F
Returns a new instance of F.
42 43 44 |
# File 'lib/dolzenko/django_f_object.rb', line 42 def initialize(attr_name) self.attr_name = attr_name.to_s end |
Instance Attribute Details
#attr_name ⇒ Object
Returns the value of attribute attr_name.
37 38 39 |
# File 'lib/dolzenko/django_f_object.rb', line 37 def attr_name @attr_name end |
#klass ⇒ Object
Returns the value of attribute klass.
38 39 40 |
# File 'lib/dolzenko/django_f_object.rb', line 38 def klass @klass end |
#operand ⇒ Object
Returns the value of attribute operand.
40 41 42 |
# File 'lib/dolzenko/django_f_object.rb', line 40 def operand @operand end |
#operator ⇒ Object
Returns the value of attribute operator.
39 40 41 |
# File 'lib/dolzenko/django_f_object.rb', line 39 def operator @operator end |
Instance Method Details
#empty? ⇒ Boolean
56 57 58 |
# File 'lib/dolzenko/django_f_object.rb', line 56 def empty? false end |
#to_sql(formatter = nil) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/dolzenko/django_f_object.rb', line 46 def to_sql(formatter = nil) self.klass ||= formatter.environment.relation.klass sql = klass.my_quote_columns(attr_name) if operator && operand operand.klass = klass if operand.is_a?(F) sql << " #{ operator } #{ operand.is_a?(F) ? operand.to_sql(formatter) : klass.connection.quote(operand) }" end sql end |