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