Class: ActiveHash::Relation::Conditions
- Inherits:
-
Object
- Object
- ActiveHash::Relation::Conditions
- Defined in:
- lib/active_hash/conditions.rb
Instance Attribute Summary collapse
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(conditions = []) ⇒ Conditions
constructor
A new instance of Conditions.
- #matches?(record) ⇒ Boolean
Constructor Details
#initialize(conditions = []) ⇒ Conditions
Returns a new instance of Conditions.
6 7 8 |
# File 'lib/active_hash/conditions.rb', line 6 def initialize(conditions = []) @conditions = conditions end |
Instance Attribute Details
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
2 3 4 |
# File 'lib/active_hash/conditions.rb', line 2 def conditions @conditions end |
Class Method Details
.wrap(conditions) ⇒ Object
16 17 18 19 20 |
# File 'lib/active_hash/conditions.rb', line 16 def self.wrap(conditions) return conditions if conditions.is_a?(self) new(conditions) end |
Instance Method Details
#matches?(record) ⇒ Boolean
10 11 12 13 14 |
# File 'lib/active_hash/conditions.rb', line 10 def matches?(record) conditions.all? do |condition| condition.matches?(record) end end |