Class: Cucumber::Core::Ast::Location::Precise

Inherits:
Struct
  • Object
show all
Defined in:
lib/cucumber/core/ast/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



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

def file
  @file
end

#linesObject

Returns the value of attribute lines

Returns:

  • (Object)

    the current value of lines



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

def lines
  @lines
end

Instance Method Details

#+(other) ⇒ Object



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

def +(other)
  raise IncompatibleLocations if file != other.file
  Precise.new(file, lines + other.lines)
end

#hashObject



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

def hash
  self.class.hash ^ to_s.hash
end

#include?(other_lines) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#inspectObject



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

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

#lineObject



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

def line
  lines.first
end

#match?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#on_line(new_line) ⇒ Object



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

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

#to_sObject



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

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

#to_strObject



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

def to_str
  to_s
end