Module: CukeSlicer::FilterHelpers
- Includes:
- MatchingHelpers
- Included in:
- ExtractionHelpers
- Defined in:
- lib/cuke_slicer/helpers/filter_helpers.rb
Overview
private
Instance Method Summary collapse
-
#apply_custom_filter(elements, &block) ⇒ Object
private.
-
#filter_excluded_paths(elements, filters) ⇒ Object
private.
-
#filter_excluded_tags(elements, filters) ⇒ Object
private.
-
#filter_included_paths(elements, filters) ⇒ Object
private.
-
#filter_included_tags(elements, filters) ⇒ Object
private.
Methods included from MatchingHelpers
#and_filter_match, #filter_match, #matching_path?, #matching_tag?, #or_filter_match
Instance Method Details
#apply_custom_filter(elements, &block) ⇒ Object
private
11 12 13 14 15 16 17 |
# File 'lib/cuke_slicer/helpers/filter_helpers.rb', line 11 def apply_custom_filter(elements, &block) return unless block elements.reject! do |element| yield(element) end end |
#filter_excluded_paths(elements, filters) ⇒ Object
private
44 45 46 47 48 49 50 51 52 |
# File 'lib/cuke_slicer/helpers/filter_helpers.rb', line 44 def filter_excluded_paths(elements, filters) return unless filters filters = [filters] unless filters.is_a?(Array) elements.reject! do |element| matching_path?(element, filters) end end |
#filter_excluded_tags(elements, filters) ⇒ Object
private
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cuke_slicer/helpers/filter_helpers.rb', line 20 def (elements, filters) return unless filters filters = [filters] unless filters.is_a?(Array) return if filters.empty? elements.reject! do |element| matching_tag?(element, filters) end end |
#filter_included_paths(elements, filters) ⇒ Object
private
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cuke_slicer/helpers/filter_helpers.rb', line 55 def filter_included_paths(elements, filters) return unless filters filters = [filters] unless filters.is_a?(Array) return if filters.empty? elements.keep_if do |element| matching_path?(element, filters) end end |
#filter_included_tags(elements, filters) ⇒ Object
private
33 34 35 36 37 38 39 40 41 |
# File 'lib/cuke_slicer/helpers/filter_helpers.rb', line 33 def (elements, filters) return unless filters filters = [filters] unless filters.is_a?(Array) elements.keep_if do |element| matching_tag?(element, filters) end end |