Class: Cucumber::CucumberExpressions::Argument
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/argument.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#parameter_type ⇒ Object
readonly
Returns the value of attribute parameter_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(group, parameter_type) ⇒ Argument
constructor
A new instance of Argument.
- #value(self_obj = :nil) ⇒ Object
Constructor Details
#initialize(group, parameter_type) ⇒ Argument
Returns a new instance of Argument.
26 27 28 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/argument.rb', line 26 def initialize(group, parameter_type) @group, @parameter_type = group, parameter_type end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/argument.rb', line 7 def group @group end |
#parameter_type ⇒ Object (readonly)
Returns the value of attribute parameter_type.
7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/argument.rb', line 7 def parameter_type @parameter_type end |
Class Method Details
.build(tree_regexp, text, parameter_types) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/argument.rb', line 9 def self.build(tree_regexp, text, parameter_types) group = tree_regexp.match(text) return nil if group.nil? arg_groups = group.children if arg_groups.length != parameter_types.length raise CucumberExpressionError.new( "Expression #{tree_regexp.regexp.inspect} has #{arg_groups.length} capture groups (#{arg_groups.map(&:value)}), but there were #{parameter_types.length} parameter types (#{parameter_types.map(&:name)})" ) end parameter_types.zip(arg_groups).map do |parameter_type, arg_group| Argument.new(arg_group, parameter_type) end end |
Instance Method Details
#value(self_obj = :nil) ⇒ Object
30 31 32 33 34 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/argument.rb', line 30 def value(self_obj=:nil) raise "No self_obj" if self_obj == :nil group_values = @group ? @group.values : nil @parameter_type.transform(self_obj, group_values) end |