Class: Text::Gen::Filter::Exclude
- Defined in:
- lib/text/gen/filter/exclude.rb
Overview
Exclude is the opposite of ‘match` and returns nil if the result metadata is matches the pattern in this filter.
Instance Method Summary collapse
Methods inherited from Base
#component_key, filter_key, filter_name, #initialize, #key, #to_s, #type, #value
Constructor Details
This class inherits a constructor from Text::Gen::Filter::Base
Instance Method Details
#result(context, result) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/text/gen/filter/exclude.rb', line 9 def result(context, result) return result if @depth && context.depth != @depth return if result.nil? return if value == "*" && result..key?(key) return if key == "*" && result..values.any? { |arr| arr.include?(value) } return if result.[key]&.include?(value) result end |