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
1784 1785 1786 1787 1788 |
# File 'lib/textbringer/buffer.rb', line 1784 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1781 1782 1783 |
# File 'lib/textbringer/buffer.rb', line 1781 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1781 1782 1783 |
# File 'lib/textbringer/buffer.rb', line 1781 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1782 1783 1784 |
# File 'lib/textbringer/buffer.rb', line 1782 def location @location end |
Instance Method Details
#delete ⇒ Object
1794 1795 1796 1797 1798 |
# File 'lib/textbringer/buffer.rb', line 1794 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1800 1801 1802 |
# File 'lib/textbringer/buffer.rb', line 1800 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1804 1805 1806 1807 1808 1809 |
# File 'lib/textbringer/buffer.rb', line 1804 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1811 1812 1813 |
# File 'lib/textbringer/buffer.rb', line 1811 def detached? @buffer.nil? end |
#dup ⇒ Object
1815 1816 1817 1818 1819 |
# File 'lib/textbringer/buffer.rb', line 1815 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1790 1791 1792 |
# File 'lib/textbringer/buffer.rb', line 1790 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |