class Cucumber::Core::Ast::Location::Lines

Public Class Methods

new(raw_data) click to toggle source
Calls superclass method
# File lib/cucumber/core/ast/location.rb, line 104
def initialize(raw_data)
  super Array(raw_data).to_set
end

Public Instance Methods

+(more_lines) click to toggle source
# File lib/cucumber/core/ast/location.rb, line 116
def +(more_lines)
  new_data = data + more_lines.data
  self.class.new(new_data)
end
first() click to toggle source
# File lib/cucumber/core/ast/location.rb, line 108
def first
  data.first
end
include?(other) click to toggle source
# File lib/cucumber/core/ast/location.rb, line 112
def include?(other)
  other.data.subset?(data) || data.subset?(other.data)
end
inspect() click to toggle source
# File lib/cucumber/core/ast/location.rb, line 127
def inspect
  "<#{self.class}: #{to_s}>"
end
to_s() click to toggle source
# File lib/cucumber/core/ast/location.rb, line 121
def to_s
  return first.to_s if data.length == 1
  return "#{data.min}..#{data.max}" if range?
  data.to_a.join(":")
end

Protected Instance Methods

range?() click to toggle source
# File lib/cucumber/core/ast/location.rb, line 133
def range?
  data.size == (data.max - data.min + 1)
end