Class: Cucumber::RbSupport::Snippet::Generator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register_on(configuration) ⇒ Object



8
9
10
# File 'lib/cucumber/rb_support/snippet.rb', line 8

def self.register_on(configuration)
  configuration.snippet_generators << new
end

Instance Method Details

#call(code_keyword, step_name, multiline_arg, snippet_type = :regexp) ⇒ Object



12
13
14
15
# File 'lib/cucumber/rb_support/snippet.rb', line 12

def call(code_keyword, step_name, multiline_arg, snippet_type = :regexp)
  snippet_class = typed_snippet_class(snippet_type)
  snippet_class.new(code_keyword, step_name, multiline_arg).to_s
end

#typed_snippet_class(type) ⇒ Object



17
18
19
# File 'lib/cucumber/rb_support/snippet.rb', line 17

def typed_snippet_class(type)
  SNIPPET_TYPES.fetch(type || :regexp)
end