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

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

Direct Known Subclasses

Classic, Percent, Regexp

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code_keyword, pattern, multiline_argument_class) ⇒ BaseSnippet

Returns a new instance of BaseSnippet.



9
10
11
12
13
14
# File 'lib/cucumber/rb_support/snippet.rb', line 9

def initialize(code_keyword, pattern, multiline_argument_class)
  @number_of_arguments = 0
  @code_keyword = code_keyword
  @pattern = replace_and_count_capturing_groups(pattern)
  @multiline_argument_class = multiline_argument_class
end

Class Method Details

.cli_option_string(type) ⇒ Object



24
25
26
# File 'lib/cucumber/rb_support/snippet.rb', line 24

def self.cli_option_string(type)
  "%-7s: %-28s e.g. %s" % [type, description, example]
end

Instance Method Details

#stepObject



20
21
22
# File 'lib/cucumber/rb_support/snippet.rb', line 20

def step
  "#{code_keyword}#{typed_pattern}"
end

#to_sObject



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

def to_s
  "#{step} #{do_block}"
end