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.
102 103 104 |
# File 'lib/cucumber/core/test/location.rb', line 102 def initialize(raw_data) super Array(raw_data).to_set end |
Instance Attribute Details
#data=(value) ⇒ Object
Sets the attribute data
99 100 101 |
# File 'lib/cucumber/core/test/location.rb', line 99 def data=(value) @data = value end |
Instance Method Details
#+(other) ⇒ Object
122 123 124 125 |
# File 'lib/cucumber/core/test/location.rb', line 122 def +(other) new_data = data + other.data self.class.new(new_data) end |
#first ⇒ Object
106 107 108 |
# File 'lib/cucumber/core/test/location.rb', line 106 def first data.first end |
#include?(other) ⇒ Boolean
118 119 120 |
# File 'lib/cucumber/core/test/location.rb', line 118 def include?(other) other.data.subset?(data) || data.subset?(other.data) end |
#inspect ⇒ Object
134 135 136 |
# File 'lib/cucumber/core/test/location.rb', line 134 def inspect "<#{self.class}: #{self}>" end |
#max ⇒ Object
114 115 116 |
# File 'lib/cucumber/core/test/location.rb', line 114 def max data.max end |
#min ⇒ Object
110 111 112 |
# File 'lib/cucumber/core/test/location.rb', line 110 def min data.min end |
#to_s ⇒ Object
127 128 129 130 131 132 |
# File 'lib/cucumber/core/test/location.rb', line 127 def to_s return first.to_s if data.length == 1 return "#{data.min}..#{data.max}" if range? data.to_a.join(':') end |