Class: Gurke::FeatureList::Filter
- Inherits:
-
Object
- Object
- Gurke::FeatureList::Filter
- Defined in:
- lib/gurke/feature_list.rb
Defined Under Namespace
Classes: TagFilter
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #filtered?(scenario) ⇒ Boolean
- #filtered_by_line?(scenario) ⇒ Boolean
- #filtered_by_tags?(scenario) ⇒ Boolean
-
#initialize(options, files) ⇒ Filter
constructor
A new instance of Filter.
- #tag_filters ⇒ Object
Constructor Details
#initialize(options, files) ⇒ Filter
Returns a new instance of Filter.
65 66 67 68 |
# File 'lib/gurke/feature_list.rb', line 65 def initialize(, files) @options = @files = files end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
63 64 65 |
# File 'lib/gurke/feature_list.rb', line 63 def files @files end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
63 64 65 |
# File 'lib/gurke/feature_list.rb', line 63 def @options end |
Instance Method Details
#filtered?(scenario) ⇒ Boolean
76 77 78 |
# File 'lib/gurke/feature_list.rb', line 76 def filtered?(scenario) (scenario) || filtered_by_line?(scenario) end |
#filtered_by_line?(scenario) ⇒ Boolean
86 87 88 89 90 91 92 |
# File 'lib/gurke/feature_list.rb', line 86 def filtered_by_line?(scenario) _, lines = files.find {|f, _| f == scenario.file } return false if lines.empty? lines.none? {|l| scenario.line <= l && scenario.steps.last.line >= l } end |
#filtered_by_tags?(scenario) ⇒ Boolean
80 81 82 83 84 |
# File 'lib/gurke/feature_list.rb', line 80 def (scenario) !tag_filters.reduce(false) do |memo, set| memo || set.all? {|rule| rule.match? scenario } end end |