method

init_expression

rspec latest stable - Class: Spec::Story::Step

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (1.1.12) is shown here.

init_expression(string_or_regexp)
private

No documentation available.

# File lib/spec/story/step.rb, line 55
      def init_expression(string_or_regexp)
        if String === string_or_regexp
          expression = string_or_regexp.dup
          %w<? ( ) [ ] { } ^ !>.each {|c| expression.gsub! c, "\\#{c}"}
        elsif Regexp === string_or_regexp
          expression = string_or_regexp.source
        end
        while expression =~ PARAM_PATTERN
          expression.sub!($2, "(.*?)")
        end
        @expression = Regexp.new("\\A#{expression}\\Z", Regexp::MULTILINE)
      end