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.



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

def initialize(raw_data)
  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



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

def data=(value)
  @data = value
end

#lineObject (readonly)

Returns the value of attribute line.



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

def line
  @line
end

Instance Method Details

#include?(other) ⇒ Boolean

Returns:

  • (Boolean)


86
87
88
89
# File 'lib/cucumber/core/ast/location.rb', line 86

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

#inspectObject



95
96
97
# File 'lib/cucumber/core/ast/location.rb', line 95

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

#to_sObject



91
92
93
# File 'lib/cucumber/core/ast/location.rb', line 91

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