Class: Uttk::Filters::KeepSkipBased
- Includes:
- Concrete
- Defined in:
- lib/uttk/filters/KeepSkipBased.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#keep ⇒ Object
readonly
Returns the value of attribute keep.
-
#skip ⇒ Object
readonly
Returns the value of attribute skip.
Instance Method Summary collapse
-
#initialize(observers, options, &b) ⇒ KeepSkipBased
constructor
A new instance of KeepSkipBased.
- #keep?(node) ⇒ Boolean
- #skip?(node) ⇒ Boolean
Methods inherited from Filter
Methods inherited from Logger::Backend
Constructor Details
#initialize(observers, options, &b) ⇒ KeepSkipBased
Returns a new instance of KeepSkipBased.
18 19 20 21 |
# File 'lib/uttk/filters/KeepSkipBased.rb', line 18 def initialize ( observers, , &b ) super @keep, @skip, @action = @options.values_at :keep, :skip, :action end |
Instance Attribute Details
#keep ⇒ Object (readonly)
Returns the value of attribute keep.
13 14 15 |
# File 'lib/uttk/filters/KeepSkipBased.rb', line 13 def keep @keep end |
#skip ⇒ Object (readonly)
Returns the value of attribute skip.
13 14 15 |
# File 'lib/uttk/filters/KeepSkipBased.rb', line 13 def skip @skip end |
Instance Method Details
#keep?(node) ⇒ Boolean
24 25 26 27 |
# File 'lib/uttk/filters/KeepSkipBased.rb', line 24 def keep? ( node ) node_s = node.to_s (node_s =~ @keep and node_s !~ @skip) end |
#skip?(node) ⇒ Boolean
30 31 32 |
# File 'lib/uttk/filters/KeepSkipBased.rb', line 30 def skip? ( node ) ! keep? node end |