Class: SafetyPin::Query::WhereCondition
- Inherits:
-
Object
- Object
- SafetyPin::Query::WhereCondition
- Defined in:
- lib/safety_pin/query/where_condition.rb
Instance Attribute Summary collapse
-
#comparator ⇒ Object
readonly
Returns the value of attribute comparator.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(object) ⇒ Object
- #eql?(object) ⇒ Boolean
-
#initialize(name, value, comparator = "=") ⇒ WhereCondition
constructor
A new instance of WhereCondition.
- #sql_fragment ⇒ Object
Constructor Details
#initialize(name, value, comparator = "=") ⇒ WhereCondition
Returns a new instance of WhereCondition.
6 7 8 9 10 |
# File 'lib/safety_pin/query/where_condition.rb', line 6 def initialize(name, value, comparator = "=") @name = name @value = value @comparator = comparator end |
Instance Attribute Details
#comparator ⇒ Object (readonly)
Returns the value of attribute comparator.
4 5 6 |
# File 'lib/safety_pin/query/where_condition.rb', line 4 def comparator @comparator end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/safety_pin/query/where_condition.rb', line 4 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/safety_pin/query/where_condition.rb', line 4 def value @value end |
Instance Method Details
#==(object) ⇒ Object
16 17 18 |
# File 'lib/safety_pin/query/where_condition.rb', line 16 def ==(object) self.name == object.name and self.value == object.value and self.comparator == object.comparator end |
#eql?(object) ⇒ Boolean
20 21 22 |
# File 'lib/safety_pin/query/where_condition.rb', line 20 def eql?(object) self == object end |
#sql_fragment ⇒ Object
12 13 14 |
# File 'lib/safety_pin/query/where_condition.rb', line 12 def sql_fragment "[#{name}] #{comparator} '#{value}'" end |