Class: ParamsReady::Query::Like
Class Method Summary
collapse
#altn, define_operator, dup
Class Method Details
.test(record, attribute_name, value) ⇒ Object
72
73
74
75
76
|
# File 'lib/params_ready/query/predicate_operator.rb', line 72
def self.test(record, attribute_name, value)
attribute = record.send attribute_name
result = Regexp.new(value, Regexp::IGNORECASE) =~ attribute
result.nil? ? false : true
end
|
.to_query(attribute_name, value) ⇒ Object
68
69
70
|
# File 'lib/params_ready/query/predicate_operator.rb', line 68
def self.to_query(attribute_name, value)
attribute_name.matches("%#{value}%")
end
|