class Cucumber::CucumberExpressions::GeneratedExpression
Attributes
parameter_types[R]
Public Class Methods
new(expression_template, parameters_types)
click to toggle source
# File lib/cucumber/cucumber_expressions/generated_expression.rb, line 6 def initialize(expression_template, parameters_types) @expression_template, @parameter_types = expression_template, parameters_types end
Public Instance Methods
parameter_names()
click to toggle source
# File lib/cucumber/cucumber_expressions/generated_expression.rb, line 14 def parameter_names usage_by_type_name = Hash.new(0) @parameter_types.map do |t| get_parameter_name(t.name, usage_by_type_name) end end
source()
click to toggle source
# File lib/cucumber/cucumber_expressions/generated_expression.rb, line 10 def source sprintf(@expression_template, *@parameter_types.map(&:name)) end
Private Instance Methods
get_parameter_name(type_name, usage_by_type_name)
click to toggle source
# File lib/cucumber/cucumber_expressions/generated_expression.rb, line 23 def get_parameter_name(type_name, usage_by_type_name) count = usage_by_type_name[type_name] count += 1 usage_by_type_name[type_name] = count count == 1 ? type_name : "#{type_name}#{count}" end