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