Class: Cartograph::PropertyCollection
- Inherits:
-
Object
- Object
- Cartograph::PropertyCollection
- Extended by:
- Forwardable
- Defined in:
- lib/cartograph/property_collection.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
- #filter_by_scope(scope) ⇒ Object
-
#initialize ⇒ PropertyCollection
constructor
A new instance of PropertyCollection.
Constructor Details
#initialize ⇒ PropertyCollection
Returns a new instance of PropertyCollection.
10 11 12 |
# File 'lib/cartograph/property_collection.rb', line 10 def initialize(*) @collection = [] end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/cartograph/property_collection.rb', line 20 def ==(other) each_with_index.inject(true) do |current_value, (property, index)| break unless current_value property == other[index] end end |
#filter_by_scope(scope) ⇒ Object
14 15 16 17 18 |
# File 'lib/cartograph/property_collection.rb', line 14 def filter_by_scope(scope) select do |property| property.scopes.include?(scope) end end |