Module: Cucumber::LanguageSupport::StepDefinitionMethods

Included in:
RbSupport::RbStepDefinition
Defined in:
lib/cucumber/language_support/step_definition_methods.rb

Instance Method Summary collapse

Instance Method Details

#backtrace_lineObject



37
38
39
# File 'lib/cucumber/language_support/step_definition_methods.rb', line 37

def backtrace_line
  "#{file_colon_line}:in `#{regexp.inspect}'"
end

#format_args(step_name, format) ⇒ Object

Formats the matched arguments of the associated Step. This method is usually called from visitors, which render output.

The format can either be a String or a Proc.

If it is a String it should be a format string according to Kernel#sprinf, for example:

'<span class="param">%s</span></tt>'

If it is a Proc, it should take one argument and return the formatted argument, for example:

lambda { |param| "[#{param}]" }


29
30
31
# File 'lib/cucumber/language_support/step_definition_methods.rb', line 29

def format_args(step_name, format)
  step_name.gzub(regexp, format)
end

#same_regexp?(regexp) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/cucumber/language_support/step_definition_methods.rb', line 33

def same_regexp?(regexp)
  self.regexp == regexp
end

#step_match(name_to_match, name_to_report) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/cucumber/language_support/step_definition_methods.rb', line 6

def step_match(name_to_match, name_to_report)
  if(match = regexp.match(name_to_match))
    StepMatch.new(self, name_to_match, name_to_report, match.captures)
  else
    nil
  end
end

#text_lengthObject



41
42
43
# File 'lib/cucumber/language_support/step_definition_methods.rb', line 41

def text_length
  regexp.inspect.jlength
end