class Kartograph::PropertyCollection

Public Class Methods

new(*) click to toggle source
# File lib/kartograph/property_collection.rb, line 10
def initialize(*)
  @collection = []
  @cache = {}
end

Public Instance Methods

==(other) click to toggle source
# File lib/kartograph/property_collection.rb, line 27
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) click to toggle source
# File lib/kartograph/property_collection.rb, line 15
def filter_by_scope(scope)
  if @cache.has_key? scope
    return @cache[scope]
  end

  @cache[scope] = select do |property|
    property.scopes.include?(scope)
  end

  @cache[scope]
end