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



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

def file
  @file
end

#linesObject

Returns the value of attribute lines

Returns:

  • (Object)

    the current value of lines



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

def lines
  @lines
end

Instance Method Details

#hashObject



75
76
77
# File 'lib/cucumber/core/test/location.rb', line 75

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

#include?(other_lines) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/cucumber/core/test/location.rb', line 57

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

#inspectObject



94
95
96
# File 'lib/cucumber/core/test/location.rb', line 94

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

#lineObject



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

def line
  lines.first
end

#match?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

  other.include?(lines)
end

#merge(multiline_arg) ⇒ Object



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

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



90
91
92
# File 'lib/cucumber/core/test/location.rb', line 90

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

#to_sObject



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

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

#to_strObject



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

def to_str
  to_s
end