Sha256: 1215f80429f92939b299631918243ed8859e305a9c2cbbf1c2f023364152283d
Contents?: true
Size: 620 Bytes
Versions: 3
Compression:
Stored size: 620 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
3 entries across 3 versions & 1 rubygems