Sha256: db5491caa1b8feb3b023e3477d4201299e10d91969e5e1120e6a629397f23a58
Contents?: true
Size: 1.8 KB
Versions: 2
Compression:
Stored size: 1.8 KB
Contents
module Cucumber class StepMatch #:nodoc: attr_reader :step_definition def initialize(step_definition, step_name, formatted_step_name, groups) @step_definition, @step_name, @formatted_step_name, @groups = step_definition, step_name, formatted_step_name, groups end def args @groups.map{|g| g.val} end def name @formatted_step_name end def invoke(multiline_arg) all_args = args all_args << multiline_arg if multiline_arg @step_definition.invoke(all_args) end # 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 # <tt>Kernel#sprinf</tt>, 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}]" } # def format_args(format = lambda{|a| a}) @formatted_step_name || @step_name.gzub(@groups, format) end def file_colon_line @step_definition.file_colon_line end def backtrace_line @step_definition.backtrace_line end def text_length @step_definition.text_length end end class NoStepMatch #:nodoc: attr_reader :step_definition, :name def initialize(step, name) @step = step @name = name end def format_args(format) @name end def file_colon_line raise "No file:line for #{@step}" unless @step.file_colon_line @step.file_colon_line end def backtrace_line @step.backtrace_line end def text_length @step.text_length end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
aslakhellesoy-cucumber-0.3.102 | lib/cucumber/step_match.rb |
cucumber-0.3.102 | lib/cucumber/step_match.rb |