Class: Faceter::Rules::MergeExcludes Private

Inherits:
AbstractMapper::PairRule
  • Object
show all
Defined in:
lib/faceter/rules/merge_excludes.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Merges two consecutive nodes that exclude keys

Instance Method Summary collapse

Instance Method Details

#optimizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/faceter/rules/merge_excludes.rb', line 21

def optimize
  Nodes::Exclude.new(selector: nodes.map(&:selector).reduce(:|))
end

#optimize?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/faceter/rules/merge_excludes.rb', line 16

def optimize?
  nodes.map { |node| node.instance_of? Nodes::Exclude }.reduce(:&)
end