Class: Cucumber::Filter
Instance Method Summary collapse
- #accept?(syntax_node) ⇒ Boolean
- #accept_example?(syntax_node, outline) ⇒ Boolean
- #at_line?(syntax_node) ⇒ Boolean
- #excluded_by_tags?(syntax_node) ⇒ Boolean
- #included_by_tags?(syntax_node) ⇒ Boolean
-
#initialize(lines, options) ⇒ Filter
constructor
A new instance of Filter.
- #matches_names?(syntax_node) ⇒ Boolean
- #matches_tags?(syntax_node) ⇒ Boolean
- #outline_at_line?(syntax_node) ⇒ Boolean
- #outline_matches_names?(syntax_node) ⇒ Boolean
Constructor Details
#initialize(lines, options) ⇒ Filter
Returns a new instance of Filter.
3 4 5 6 7 8 |
# File 'lib/cucumber/filter.rb', line 3 def initialize(lines, ) @lines = lines @include_tags = [:include_tags] || [] @exclude_tags = [:exclude_tags] || [] @name_regexps = [:name_regexps] || [] end |
Instance Method Details
#accept?(syntax_node) ⇒ Boolean
10 11 12 13 14 |
# File 'lib/cucumber/filter.rb', line 10 def accept?(syntax_node) at_line?(syntax_node) && (syntax_node) && matches_names?(syntax_node) end |
#accept_example?(syntax_node, outline) ⇒ Boolean
16 17 18 19 |
# File 'lib/cucumber/filter.rb', line 16 def accept_example?(syntax_node, outline) (at_line?(syntax_node) || outline_at_line?(outline)) && (matches_names?(syntax_node) || outline_matches_names?(outline)) end |
#at_line?(syntax_node) ⇒ Boolean
21 22 23 |
# File 'lib/cucumber/filter.rb', line 21 def at_line?(syntax_node) @lines.nil? || @lines.empty? || @lines.detect{|line| syntax_node.at_line?(line)} end |
#excluded_by_tags?(syntax_node) ⇒ Boolean
38 39 40 |
# File 'lib/cucumber/filter.rb', line 38 def (syntax_node) @exclude_tags.any? && syntax_node.(@exclude_tags) end |
#included_by_tags?(syntax_node) ⇒ Boolean
34 35 36 |
# File 'lib/cucumber/filter.rb', line 34 def (syntax_node) @include_tags.empty? || syntax_node.(@include_tags) end |
#matches_names?(syntax_node) ⇒ Boolean
46 47 48 |
# File 'lib/cucumber/filter.rb', line 46 def matches_names?(syntax_node) @name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.matches_name?(name_regexp)} end |
#matches_tags?(syntax_node) ⇒ Boolean
29 30 31 32 |
# File 'lib/cucumber/filter.rb', line 29 def (syntax_node) !(syntax_node) && (syntax_node) end |
#outline_at_line?(syntax_node) ⇒ Boolean
25 26 27 |
# File 'lib/cucumber/filter.rb', line 25 def outline_at_line?(syntax_node) @lines.nil? || @lines.empty? || @lines.detect{|line| syntax_node.outline_at_line?(line)} end |
#outline_matches_names?(syntax_node) ⇒ Boolean
42 43 44 |
# File 'lib/cucumber/filter.rb', line 42 def outline_matches_names?(syntax_node) @name_regexps.nil? || @name_regexps.empty? || @name_regexps.detect{|name_regexp| syntax_node.outline_matches_name?(name_regexp)} end |