Class: Cucumber::Core::Test::Location::Lines
- Inherits:
-
Struct
- Object
- Struct
- Cucumber::Core::Test::Location::Lines
- Defined in:
- lib/cucumber/core/test/location.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
writeonly
Sets the attribute data.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #first ⇒ Object
- #include?(other) ⇒ Boolean
-
#initialize(raw_data) ⇒ Lines
constructor
A new instance of Lines.
- #inspect ⇒ Object
- #max ⇒ Object
- #min ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(raw_data) ⇒ Lines
Returns a new instance of Lines.
100 101 102 |
# File 'lib/cucumber/core/test/location.rb', line 100 def initialize(raw_data) super(Array(raw_data).to_set) end |
Instance Attribute Details
#data=(value) ⇒ Object
Sets the attribute data
97 98 99 |
# File 'lib/cucumber/core/test/location.rb', line 97 def data=(value) @data = value end |
Instance Method Details
#+(other) ⇒ Object
120 121 122 123 |
# File 'lib/cucumber/core/test/location.rb', line 120 def +(other) new_data = data + other.data self.class.new(new_data) end |
#first ⇒ Object
104 105 106 |
# File 'lib/cucumber/core/test/location.rb', line 104 def first data.first end |
#include?(other) ⇒ Boolean
116 117 118 |
# File 'lib/cucumber/core/test/location.rb', line 116 def include?(other) other.data.subset?(data) || data.subset?(other.data) end |
#inspect ⇒ Object
132 133 134 |
# File 'lib/cucumber/core/test/location.rb', line 132 def inspect "<#{self.class}: #{self}>" end |
#max ⇒ Object
112 113 114 |
# File 'lib/cucumber/core/test/location.rb', line 112 def max data.max end |
#min ⇒ Object
108 109 110 |
# File 'lib/cucumber/core/test/location.rb', line 108 def min data.min end |
#to_s ⇒ Object
125 126 127 128 129 130 |
# File 'lib/cucumber/core/test/location.rb', line 125 def to_s return first.to_s if data.length == 1 return "#{data.min}..#{data.max}" if range? data.to_a.join(':') end |