Class: Cucumber::Core::Ast::Location::Precise
- Inherits:
-
Struct
- Object
- Struct
- Cucumber::Core::Ast::Location::Precise
- Defined in:
- lib/cucumber/core/ast/location.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#lines ⇒ Object
Returns the value of attribute lines.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #hash ⇒ Object
- #include?(other_lines) ⇒ Boolean
- #inspect ⇒ Object
- #line ⇒ Object
- #match?(other) ⇒ Boolean
- #on_line(new_line) ⇒ Object
- #to_s ⇒ Object
- #to_str ⇒ Object
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file
60 61 62 |
# File 'lib/cucumber/core/ast/location.rb', line 60 def file @file end |
#lines ⇒ Object
Returns the value of attribute 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 |
#hash ⇒ Object
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
61 62 63 |
# File 'lib/cucumber/core/ast/location.rb', line 61 def include?(other_lines) lines.include?(other_lines) end |
#inspect ⇒ Object
95 96 97 |
# File 'lib/cucumber/core/ast/location.rb', line 95 def inspect "<#{self.class}: #{to_s}>" end |
#line ⇒ Object
65 66 67 |
# File 'lib/cucumber/core/ast/location.rb', line 65 def line lines.first end |
#match?(other) ⇒ 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_s ⇒ Object
74 75 76 |
# File 'lib/cucumber/core/ast/location.rb', line 74 def to_s [file, lines.to_s].join(":") end |
#to_str ⇒ Object
82 83 84 |
# File 'lib/cucumber/core/ast/location.rb', line 82 def to_str to_s end |