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.
1737 1738 1739 1740 1741 |
# File 'lib/textbringer/buffer.rb', line 1737 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1734 1735 1736 |
# File 'lib/textbringer/buffer.rb', line 1734 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1734 1735 1736 |
# File 'lib/textbringer/buffer.rb', line 1734 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1735 1736 1737 |
# File 'lib/textbringer/buffer.rb', line 1735 def location @location end |
Instance Method Details
#delete ⇒ Object
1747 1748 1749 1750 1751 |
# File 'lib/textbringer/buffer.rb', line 1747 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1753 1754 1755 |
# File 'lib/textbringer/buffer.rb', line 1753 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1757 1758 1759 1760 1761 1762 |
# File 'lib/textbringer/buffer.rb', line 1757 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1764 1765 1766 |
# File 'lib/textbringer/buffer.rb', line 1764 def detached? @buffer.nil? end |
#dup ⇒ Object
1768 1769 1770 1771 1772 |
# File 'lib/textbringer/buffer.rb', line 1768 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1743 1744 1745 |
# File 'lib/textbringer/buffer.rb', line 1743 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |