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.
1596 1597 1598 1599 1600 |
# File 'lib/textbringer/buffer.rb', line 1596 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1593 1594 1595 |
# File 'lib/textbringer/buffer.rb', line 1593 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1593 1594 1595 |
# File 'lib/textbringer/buffer.rb', line 1593 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1594 1595 1596 |
# File 'lib/textbringer/buffer.rb', line 1594 def location @location end |
Instance Method Details
#delete ⇒ Object
1606 1607 1608 1609 1610 |
# File 'lib/textbringer/buffer.rb', line 1606 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1612 1613 1614 |
# File 'lib/textbringer/buffer.rb', line 1612 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1616 1617 1618 1619 1620 1621 |
# File 'lib/textbringer/buffer.rb', line 1616 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1623 1624 1625 |
# File 'lib/textbringer/buffer.rb', line 1623 def detached? @buffer.nil? end |
#dup ⇒ Object
1627 1628 1629 1630 1631 |
# File 'lib/textbringer/buffer.rb', line 1627 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1602 1603 1604 |
# File 'lib/textbringer/buffer.rb', line 1602 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |