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
61 62 63 |
# File 'lib/cucumber/core/ast/location.rb', line 61 def file @file end |
#lines ⇒ Object
Returns the value of attribute 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 |
#hash ⇒ Object
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
62 63 64 |
# File 'lib/cucumber/core/ast/location.rb', line 62 def include?(other_lines) lines.include?(other_lines) end |
#inspect ⇒ Object
96 97 98 |
# File 'lib/cucumber/core/ast/location.rb', line 96 def inspect "<#{self.class}: #{to_s}>" end |
#line ⇒ Object
66 67 68 |
# File 'lib/cucumber/core/ast/location.rb', line 66 def line lines.first end |
#match?(other) ⇒ 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_s ⇒ Object
75 76 77 |
# File 'lib/cucumber/core/ast/location.rb', line 75 def to_s [file, lines.to_s].join(":") end |
#to_str ⇒ Object
83 84 85 |
# File 'lib/cucumber/core/ast/location.rb', line 83 def to_str to_s end |