Sha256: 467ad19f32864ff99b0373688e4a3ef4a0b7a0ee6e65c9cf38b902c50d1bbc9e
Contents?: true
Size: 619 Bytes
Versions: 9
Compression:
Stored size: 619 Bytes
Contents
class Eco::Data::Locations::NodeDiff 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}?".to_sym define_method meth do diffs.select(&methq) end define_method methq do diffs.any(&methq) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems