Class: Uttk::Filters::NodeCut
- Inherits:
-
KeepSkipBased
- Object
- Logger::Backend
- Filter
- Id
- KeepSkipBased
- Uttk::Filters::NodeCut
- Includes:
- Concrete
- Defined in:
- lib/uttk/filters/NodeCut.rb
Overview
FIXME Can be path based This filter cut nodes which match ‘keep’ but not ‘skip’
options:
keep: A regular expression (all keys which match this regexp are cut)
skip: Antoher regexp that skip keys which match
prune: Completly cut all sub nodes of a cut one
Defined Under Namespace
Modules: Assertions
Instance Attribute Summary
Attributes inherited from KeepSkipBased
Instance Method Summary collapse
-
#initialize(*a, &b) ⇒ NodeCut
constructor
A new instance of NodeCut.
- #prune? ⇒ Boolean
- #pruning_path?(path) ⇒ Boolean
Methods inherited from KeepSkipBased
Methods inherited from Filter
Methods inherited from Logger::Backend
Constructor Details
#initialize(*a, &b) ⇒ NodeCut
Returns a new instance of NodeCut.
22 23 24 25 26 |
# File 'lib/uttk/filters/NodeCut.rb', line 22 def initialize ( *a, &b ) super @pruning_path = Set.new @pruning_path_node = nil end |
Instance Method Details
#prune? ⇒ Boolean
68 69 70 |
# File 'lib/uttk/filters/NodeCut.rb', line 68 def prune? @options[:prune] end |
#pruning_path?(path) ⇒ Boolean
73 74 75 76 77 78 79 |
# File 'lib/uttk/filters/NodeCut.rb', line 73 def pruning_path? ( path ) return false unless @pruning_path_node @pruning_path_node.each_with_index do |seg, i| return false if seg != path[i] end return true end |