Class: ActiveRecord::Inequality::Like
- Defined in:
- lib/inequal_opportunity.rb
Instance Method Summary collapse
- #operator ⇒ Object
-
#value(override = false) ⇒ Object
This method is why I love Ruby.
Methods inherited from Base
#==, #initialize, #inspect, #string_value
Constructor Details
This class inherits a constructor from ActiveRecord::Inequality::Base
Instance Method Details
#operator ⇒ Object
70 71 72 |
# File 'lib/inequal_opportunity.rb', line 70 def operator 'LIKE' end |
#value(override = false) ⇒ Object
This method is why I love Ruby
75 76 77 78 79 80 81 82 83 |
# File 'lib/inequal_opportunity.rb', line 75 def value(override = false) v = super(*[]) if !override && !v.is_a?(Numeric) && !v.is_a?(String) raise InequalError, "Passing #{v.class} to Like. You can't possibly want to do this" end "%#{v}%" end |