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.
1710 1711 1712 1713 1714 |
# File 'lib/textbringer/buffer.rb', line 1710 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1707 1708 1709 |
# File 'lib/textbringer/buffer.rb', line 1707 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1707 1708 1709 |
# File 'lib/textbringer/buffer.rb', line 1707 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1708 1709 1710 |
# File 'lib/textbringer/buffer.rb', line 1708 def location @location end |
Instance Method Details
#delete ⇒ Object
1720 1721 1722 1723 1724 |
# File 'lib/textbringer/buffer.rb', line 1720 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1726 1727 1728 |
# File 'lib/textbringer/buffer.rb', line 1726 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1730 1731 1732 1733 1734 1735 |
# File 'lib/textbringer/buffer.rb', line 1730 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1737 1738 1739 |
# File 'lib/textbringer/buffer.rb', line 1737 def detached? @buffer.nil? end |
#dup ⇒ Object
1741 1742 1743 1744 1745 |
# File 'lib/textbringer/buffer.rb', line 1741 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1716 1717 1718 |
# File 'lib/textbringer/buffer.rb', line 1716 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |