Class: Cucumber::Core::Test::Location::Precise

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



54
55
56
# File 'lib/cucumber/core/test/location.rb', line 54

def file
  @file
end

#linesObject

Returns the value of attribute lines

Returns:

  • (Object)

    the current value of lines



54
55
56
# File 'lib/cucumber/core/test/location.rb', line 54

def lines
  @lines
end

Instance Method Details

#hashObject



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

def hash
  [self.class, to_s].hash
end

#include?(other_lines) ⇒ Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/cucumber/core/test/location.rb', line 55

def include?(other_lines)
  lines.include?(other_lines)
end

#inspectObject



92
93
94
# File 'lib/cucumber/core/test/location.rb', line 92

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

#lineObject



59
60
61
# File 'lib/cucumber/core/test/location.rb', line 59

def line
  lines.first
end

#match?(other) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
66
67
# File 'lib/cucumber/core/test/location.rb', line 63

def match?(other)
  return false unless other.file == file

  other.include?(lines)
end

#merge(multiline_arg) ⇒ Object



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

def merge(multiline_arg)
  new_lines = (0..multiline_arg.lines_count).map do |offset|
    lines.min + offset
  end
  Location.new(file, new_lines)
end

#on_line(new_line) ⇒ Object



88
89
90
# File 'lib/cucumber/core/test/location.rb', line 88

def on_line(new_line)
  Location.new(file, new_line)
end

#to_sObject



69
70
71
# File 'lib/cucumber/core/test/location.rb', line 69

def to_s
  [file, lines.to_s].join(':')
end

#to_strObject



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

def to_str
  to_s
end