Class: Cucumber::RbSupport::Snippet::BaseSnippet

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/en_snippet.rb

Instance Method Summary collapse

Instance Method Details

#initialize_with_en_keyword(code_keyword, pattern, multiline_argument_class) ⇒ Object Also known as: initialize



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cucumber/en_snippet.rb', line 15

def initialize_with_en_keyword(code_keyword, pattern, multiline_argument_class)
  case
  when ::Regexp.new(Gherkin::I18n.keyword_regexp(:given)) =~ code_keyword
    en_keyword = 'Given'
  when ::Regexp.new(Gherkin::I18n.keyword_regexp(:when)) =~ code_keyword
    en_keyword = 'When'
  when ::Regexp.new(Gherkin::I18n.keyword_regexp(:then)) =~ code_keyword
    en_keyword = 'Then'
  else
    en_keyword = code_keyword
  end

  initialize_without_en_keyword(en_keyword, pattern, multiline_argument_class)
end