Sha256: 7f06e9b96a8586b8b43bb52d04daa202431b28e66161c1485be257db0a764305

Contents?: true

Size: 626 Bytes

Versions: 36

Compression:

Stored size: 626 Bytes

Contents

class Eco::Data::Locations::NodeDiff::NodesDiff
  module Selectors
    # Creates selector methods on `diffs` (nodes that changed)
    # It also creates a method with question mark that evaluates true if **any** diff matches.
    # @note the selector method name with a question mark should exist in the `diff_result_class`
    def selector(*attrs)
      attrs.each do |attr|
        meth = attr.to_sym
        methq = :"#{meth}?"

        define_method meth do
          diffs.select(&methq)
        end

        define_method methq do
          diffs.any?(&methq)
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
eco-helpers-3.0.21 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.20 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.19 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.18 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.17 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.16 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.15 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.14 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.13 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.12 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.11 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.10 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.9 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.8 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.7 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.6 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.5 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.4 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.3 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb
eco-helpers-3.0.2 lib/eco/data/locations/node_diff/nodes_diff/selectors.rb