Sha256: 9d19832d183306ac2b6eb13f89923d3f6d4e2edc3e6d3604ea0e00423729faf0

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

module Cucumber
  module LanguageSupport
    module StepDefinitionMethods
      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

      # 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(step_name, format)
        step_name.gzub(regexp, format)
      end

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

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

      def text_length
        regexp.inspect.jlength
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
aslakhellesoy-cucumber-0.3.96 lib/cucumber/language_support/step_definition_methods.rb
aslakhellesoy-cucumber-0.3.97 lib/cucumber/language_support/step_definition_methods.rb
aslakhellesoy-cucumber-0.3.98 lib/cucumber/language_support/step_definition_methods.rb
kosmas58-cucumber-0.3.96 lib/cucumber/language_support/step_definition_methods.rb
kosmas58-cucumber-0.3.97 lib/cucumber/language_support/step_definition_methods.rb
kosmas58-cucumber-0.3.98 lib/cucumber/language_support/step_definition_methods.rb
cucumber-0.3.98 lib/cucumber/language_support/step_definition_methods.rb
cucumber-0.3.97 lib/cucumber/language_support/step_definition_methods.rb
cucumber-0.3.96 lib/cucumber/language_support/step_definition_methods.rb