Class: Cucumber::Core::Ast::Location::Lines

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/core/ast/location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ Lines

Returns a new instance of Lines.



54
55
56
57
58
59
60
# File 'lib/cucumber/core/ast/location.rb', line 54

def initialize(line)
  if Cucumber::JRUBY && line.is_a?(::Java::GherkinFormatterModel::Range)
    line = Range.new(line.first, line.last)
  end
  @line = line
  @data = Array(line).to_set
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



53
54
55
# File 'lib/cucumber/core/ast/location.rb', line 53

def line
  @line
end

Instance Method Details

#==(other) ⇒ Object



71
72
73
# File 'lib/cucumber/core/ast/location.rb', line 71

def ==(other)
  other.data == data
end

#include?(other) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
65
# File 'lib/cucumber/core/ast/location.rb', line 62

def include?(other)
  return true if (data|other.data).include?(WILDCARD)
  other.data.subset?(data) || data.subset?(other.data)
end

#to_sObject



67
68
69
# File 'lib/cucumber/core/ast/location.rb', line 67

def to_s
  boundary.join('..')
end