Class: Textbringer::Mark
- Inherits:
-
Object
- Object
- Textbringer::Mark
- Defined in:
- lib/textbringer/buffer.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#location ⇒ Object
Returns the value of attribute location.
Instance Method Summary collapse
- #delete ⇒ Object
- #deleted? ⇒ Boolean
- #detach ⇒ Object
- #detached? ⇒ Boolean
- #dup ⇒ Object
-
#initialize(buffer, location) ⇒ Mark
constructor
A new instance of Mark.
- #inspect ⇒ Object
Constructor Details
#initialize(buffer, location) ⇒ Mark
Returns a new instance of Mark.
1549 1550 1551 1552 1553 |
# File 'lib/textbringer/buffer.rb', line 1549 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1546 1547 1548 |
# File 'lib/textbringer/buffer.rb', line 1546 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1546 1547 1548 |
# File 'lib/textbringer/buffer.rb', line 1546 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1547 1548 1549 |
# File 'lib/textbringer/buffer.rb', line 1547 def location @location end |
Instance Method Details
#delete ⇒ Object
1559 1560 1561 1562 1563 |
# File 'lib/textbringer/buffer.rb', line 1559 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1565 1566 1567 |
# File 'lib/textbringer/buffer.rb', line 1565 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1569 1570 1571 1572 1573 1574 |
# File 'lib/textbringer/buffer.rb', line 1569 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1576 1577 1578 |
# File 'lib/textbringer/buffer.rb', line 1576 def detached? @buffer.nil? end |
#dup ⇒ Object
1580 1581 1582 1583 1584 |
# File 'lib/textbringer/buffer.rb', line 1580 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1555 1556 1557 |
# File 'lib/textbringer/buffer.rb', line 1555 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |