class Cartograph::PropertyCollection

Constants

WARNING_METHODS

When either of these methods is used with 'def_delegators' Ruby prints a warning such as “possibly useless use of … in void context”. To work around it, we skip them in 'def_delegators' and define them manually.

Public Class Methods

new(*) click to toggle source
# File lib/cartograph/property_collection.rb, line 18
def initialize(*)
  @collection = []
end

Public Instance Methods

&(other) click to toggle source
# File lib/cartograph/property_collection.rb, line 35
def &(other)
  @collection & other
end
*(other) click to toggle source
# File lib/cartograph/property_collection.rb, line 39
def *(other)
  @collection * other
end
+(other) click to toggle source
# File lib/cartograph/property_collection.rb, line 43
def +(other)
  @collection + other
end
-(other) click to toggle source
# File lib/cartograph/property_collection.rb, line 47
def -(other)
  @collection + other
end
==(other) click to toggle source
# File lib/cartograph/property_collection.rb, line 28
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/cartograph/property_collection.rb, line 22
def filter_by_scope(scope)
  select do |property|
    property.scopes.include?(scope)
  end
end
|(other) click to toggle source
# File lib/cartograph/property_collection.rb, line 51
def |(other)
  @collection | other
end