Class: Cucumber::CucumberExpressions::ExpressionFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/expression_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(parameter_type_registry) ⇒ ExpressionFactory

Returns a new instance of ExpressionFactory.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/expression_factory.rb', line 8

def initialize(parameter_type_registry)
  @parameter_type_registry = parameter_type_registry
end

Instance Method Details

#create_expression(string_or_regexp) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/expression_factory.rb', line 12

def create_expression(string_or_regexp)
  case string_or_regexp
  when String then CucumberExpression.new(string_or_regexp, @parameter_type_registry)
  when Regexp then RegularExpression.new(string_or_regexp, @parameter_type_registry)
  else
    raise CucumberExpressionError.new("Can't create an expression from #{string_or_regexp.inspect}")
  end
end