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



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

def file
  @file
end

#linesObject

Returns the value of attribute lines

Returns:

  • (Object)

    the current value of lines



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

def lines
  @lines
end

Instance Method Details

#+(other) ⇒ Object



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

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

#hashObject



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

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

#include?(other_lines) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#inspectObject



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

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

#lineObject



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

def line
  lines.first
end

#match?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#on_line(new_line) ⇒ Object



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

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

#to_sObject



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

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

#to_strObject



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

def to_str
  to_s
end