Class: ActiveModel::Relation::WhereClause::EqualsPredicate
- Defined in:
- lib/active_model/relation/where_clause.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #call(record) ⇒ Object
-
#initialize(attribute, value) ⇒ EqualsPredicate
constructor
A new instance of EqualsPredicate.
Methods inherited from Predicate
Constructor Details
#initialize(attribute, value) ⇒ EqualsPredicate
Returns a new instance of EqualsPredicate.
19 20 21 22 23 24 |
# File 'lib/active_model/relation/where_clause.rb', line 19 def initialize(attribute, value) super() @attribute = attribute @value = value end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
17 18 19 |
# File 'lib/active_model/relation/where_clause.rb', line 17 def attribute @attribute end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
17 18 19 |
# File 'lib/active_model/relation/where_clause.rb', line 17 def value @value end |
Instance Method Details
#call(record) ⇒ Object
26 27 28 |
# File 'lib/active_model/relation/where_clause.rb', line 26 def call(record) record.public_send(attribute) == value end |