Class: Gherkin::Listener::Event
- Inherits:
-
Array
- Object
- Array
- Gherkin::Listener::Event
- Defined in:
- lib/gherkin/listener/event.rb
Instance Method Summary collapse
- #event ⇒ Object
- #keyword ⇒ Object
- #line_match?(lines) ⇒ Boolean
- #name_match?(name_regexen) ⇒ Boolean
- #replay(listener) ⇒ Object
Instance Method Details
#event ⇒ Object
4 5 6 |
# File 'lib/gherkin/listener/event.rb', line 4 def event self[0] end |
#keyword ⇒ Object
8 9 10 |
# File 'lib/gherkin/listener/event.rb', line 8 def keyword self[1] end |
#line_match?(lines) ⇒ Boolean
12 13 14 |
# File 'lib/gherkin/listener/event.rb', line 12 def line_match?(lines) lines.include?(line) end |
#name_match?(name_regexen) ⇒ Boolean
16 17 18 19 |
# File 'lib/gherkin/listener/event.rb', line 16 def name_match?(name_regexen) return false unless [:feature, :background, :scenario, :scenario_outline, :examples].include?(event) name_regexen.detect{|name_regex| name =~ name_regex} end |
#replay(listener) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/gherkin/listener/event.rb', line 21 def replay(listener) begin listener.__send__(event, *args) rescue ArgumentError => e e. << "\nListener: #{listener.class}, args: #{args.inspect}" raise e end end |