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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_data) ⇒ Lines

Returns a new instance of Lines.



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

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

Instance Attribute Details

#data=(value) ⇒ Object

Sets the attribute data

Parameters:

  • value (Object)

    the value to set the attribute data to.

Returns:

  • (Object)

    the newly set value



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

def data=(value)
  @data = value
end

#lineObject (readonly)

Returns the value of attribute line.



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

def line
  @line
end

Instance Method Details

#include?(other) ⇒ Boolean

Returns:

  • (Boolean)


73
74
75
76
# File 'lib/cucumber/core/ast/location.rb', line 73

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

#inspectObject



82
83
84
# File 'lib/cucumber/core/ast/location.rb', line 82

def inspect
  "<#{self.class}: #{to_s}>"
end

#to_sObject



78
79
80
# File 'lib/cucumber/core/ast/location.rb', line 78

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