Class: Cucumber::CucumberExpressions::ParameterTypeMatcher

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/parameter_type_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameter_type, regexp, text, match_position = 0) ⇒ ParameterTypeMatcher

Returns a new instance of ParameterTypeMatcher.



6
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/parameter_type_matcher.rb', line 6

def initialize(parameter_type, regexp, text, match_position=0)
  @parameter_type, @regexp, @text = parameter_type, regexp, text
  @match = @regexp.match(@text, match_position)
end

Instance Attribute Details

#parameter_typeObject (readonly)

Returns the value of attribute parameter_type.



4
5
6
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/parameter_type_matcher.rb', line 4

def parameter_type
  @parameter_type
end

Instance Method Details

#<=>(other) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/parameter_type_matcher.rb', line 38

def <=>(other)
  pos_comparison = start <=> other.start
  return pos_comparison if pos_comparison != 0
  length_comparison = other.group.length <=> group.length
  return length_comparison if length_comparison != 0
  0
end

#advance_to(new_match_position) ⇒ Object



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

def advance_to(new_match_position)
  (new_match_position...@text.length).each {|advancedPos|
    matcher = self.class.new(parameter_type, @regexp, @text, advancedPos)
    if matcher.find && matcher.full_word?
      return matcher
    end
  }

  self.class.new(parameter_type, @regexp, @text, @text.length)
end

#findObject



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/parameter_type_matcher.rb', line 22

def find
  !@match.nil? && !group.empty?
end

#full_word?Boolean

Returns:

  • (Boolean)


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/parameter_type_matcher.rb', line 26

def full_word?
  space_before_match_or_sentence_start? && space_after_match_or_sentence_end?
end

#groupObject



34
35
36
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/parameter_type_matcher.rb', line 34

def group
  @match.captures[0]
end

#startObject



30
31
32
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-cucumber-expressions-15.2.0/lib/cucumber/cucumber_expressions/parameter_type_matcher.rb', line 30

def start
  @match.begin(0)
end