Class: Cucumber::Core::Test::Location::Lines

Inherits:
Struct show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#as_json

Constructor Details

#initialize(raw_data) ⇒ Lines

Returns a new instance of Lines.



95
96
97
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 95

def initialize(raw_data)
  super Array(raw_data).to_set
end

Instance Attribute Details

#data=(value) ⇒ Object

Sets the attribute data

Parameters:

  • value (Object)

    the value to set the attribute data to.

Returns:

  • (Object)

    the newly set value



92
93
94
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 92

def data=(value)
  @data = value
end

Instance Method Details

#+(other) ⇒ Object



115
116
117
118
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 115

def +(other)
  new_data = data + other.data
  self.class.new(new_data)
end

#firstObject



99
100
101
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 99

def first
  data.first
end

#include?(other) ⇒ Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 111

def include?(other)
  other.data.subset?(data) || data.subset?(other.data)
end

#inspectObject



127
128
129
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 127

def inspect
  "<#{self.class}: #{self}>"
end

#maxObject



107
108
109
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 107

def max
  data.max
end

#minObject



103
104
105
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 103

def min
  data.min
end

#to_sObject



120
121
122
123
124
125
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/location.rb', line 120

def to_s
  return first.to_s if data.length == 1
  return "#{data.min}..#{data.max}" if range?

  data.to_a.join(":")
end