method
init_expression
1.1.12 -
Show latest stable
-
0 notes -
Class: Spec::Story::Step
- 1.1.4
- 1.1.12 (0)
- 1.2.0
- 1.2.8
- 1.3.0
- 1.3.1
- What's this?
init_expression(string_or_regexp)
private
Hide source
# 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