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.
1499 1500 1501 1502 1503 |
# File 'lib/textbringer/buffer.rb', line 1499 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1496 1497 1498 |
# File 'lib/textbringer/buffer.rb', line 1496 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1496 1497 1498 |
# File 'lib/textbringer/buffer.rb', line 1496 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1497 1498 1499 |
# File 'lib/textbringer/buffer.rb', line 1497 def location @location end |
Instance Method Details
#delete ⇒ Object
1509 1510 1511 1512 1513 |
# File 'lib/textbringer/buffer.rb', line 1509 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1515 1516 1517 |
# File 'lib/textbringer/buffer.rb', line 1515 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1519 1520 1521 1522 1523 1524 |
# File 'lib/textbringer/buffer.rb', line 1519 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1526 1527 1528 |
# File 'lib/textbringer/buffer.rb', line 1526 def detached? @buffer.nil? end |
#dup ⇒ Object
1530 1531 1532 1533 1534 |
# File 'lib/textbringer/buffer.rb', line 1530 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1505 1506 1507 |
# File 'lib/textbringer/buffer.rb', line 1505 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |