Module: CukeSlicer::MatchingHelpers
- Included in:
- FilterHelpers
- Defined in:
- lib/cuke_slicer/helpers/matching_helpers.rb
Overview
private
Instance Method Summary collapse
-
#and_filter_match(element, filter) ⇒ Object
private.
-
#filter_match(element, filter) ⇒ Object
private.
-
#matching_path?(element, filters) ⇒ Boolean
private.
-
#matching_tag?(element, filters) ⇒ Boolean
private.
-
#or_filter_match(element, filters) ⇒ Object
private.
Instance Method Details
#and_filter_match(element, filter) ⇒ Object
private
23 24 25 |
# File 'lib/cuke_slicer/helpers/matching_helpers.rb', line 23 def and_filter_match(element, filter) filter_match(element, filter) end |
#filter_match(element, filter) ⇒ Object
private
35 36 37 38 39 40 41 42 43 |
# File 'lib/cuke_slicer/helpers/matching_helpers.rb', line 35 def filter_match(element, filter) tag_values = element..map(&:name) if filter.is_a?(Regexp) tag_values.any? { |tag| tag =~ filter } else tag_values.include?(filter) end end |
#matching_path?(element, filters) ⇒ Boolean
private
46 47 48 49 50 51 52 53 54 |
# File 'lib/cuke_slicer/helpers/matching_helpers.rb', line 46 def matching_path?(element, filters) filters.any? do |filtered_path| if filtered_path.is_a?(Regexp) element.get_ancestor(:feature_file).path =~ filtered_path else element.get_ancestor(:feature_file).path == filtered_path end end end |
#matching_tag?(element, filters) ⇒ Boolean
private
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cuke_slicer/helpers/matching_helpers.rb', line 8 def matching_tag?(element, filters) filters.each do |filter| filter_match = if filter.is_a?(Array) or_filter_match(element, filter) else and_filter_match(element, filter) end return false unless filter_match end true end |
#or_filter_match(element, filters) ⇒ Object
private
28 29 30 31 32 |
# File 'lib/cuke_slicer/helpers/matching_helpers.rb', line 28 def or_filter_match(element, filters) filters.any? do |filter| filter_match(element, filter) end end |