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.
1765 1766 1767 1768 1769 |
# File 'lib/textbringer/buffer.rb', line 1765 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1762 1763 1764 |
# File 'lib/textbringer/buffer.rb', line 1762 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1762 1763 1764 |
# File 'lib/textbringer/buffer.rb', line 1762 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1763 1764 1765 |
# File 'lib/textbringer/buffer.rb', line 1763 def location @location end |
Instance Method Details
#delete ⇒ Object
1775 1776 1777 1778 1779 |
# File 'lib/textbringer/buffer.rb', line 1775 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1781 1782 1783 |
# File 'lib/textbringer/buffer.rb', line 1781 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1785 1786 1787 1788 1789 1790 |
# File 'lib/textbringer/buffer.rb', line 1785 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1792 1793 1794 |
# File 'lib/textbringer/buffer.rb', line 1792 def detached? @buffer.nil? end |
#dup ⇒ Object
1796 1797 1798 1799 1800 |
# File 'lib/textbringer/buffer.rb', line 1796 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1771 1772 1773 |
# File 'lib/textbringer/buffer.rb', line 1771 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |