Class: Cucumber::Glue::Snippet::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/glue/snippet.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cucumber_expression_generator) ⇒ Generator

Returns a new instance of Generator.



13
14
15
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/glue/snippet.rb', line 13

def initialize(cucumber_expression_generator)
  @cucumber_expression_generator = cucumber_expression_generator
end

Class Method Details

.register_on(configuration) ⇒ Object



9
10
11
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/glue/snippet.rb', line 9

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

Instance Method Details

#call(code_keyword, step_name, multiline_arg, snippet_type) ⇒ Object



17
18
19
20
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/glue/snippet.rb', line 17

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

#typed_snippet_class(type) ⇒ Object



22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/glue/snippet.rb', line 22

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