Class: Cucumber::CucumberExpressions::GeneratedExpression

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/cucumber_expressions/generated_expression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expression_template, parameters_types) ⇒ GeneratedExpression

Returns a new instance of GeneratedExpression.



8
9
10
# File 'lib/cucumber/cucumber_expressions/generated_expression.rb', line 8

def initialize(expression_template, parameters_types)
  @expression_template, @parameter_types = expression_template, parameters_types
end

Instance Attribute Details

#parameter_typesObject (readonly)

Returns the value of attribute parameter_types.



6
7
8
# File 'lib/cucumber/cucumber_expressions/generated_expression.rb', line 6

def parameter_types
  @parameter_types
end

Instance Method Details

#parameter_namesObject



16
17
18
19
20
21
# File 'lib/cucumber/cucumber_expressions/generated_expression.rb', line 16

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

#sourceObject



12
13
14
# File 'lib/cucumber/cucumber_expressions/generated_expression.rb', line 12

def source
  sprintf(@expression_template, *@parameter_types.map(&:name))
end