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.
1893 1894 1895 1896 1897 |
# File 'lib/textbringer/buffer.rb', line 1893 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1890 1891 1892 |
# File 'lib/textbringer/buffer.rb', line 1890 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1890 1891 1892 |
# File 'lib/textbringer/buffer.rb', line 1890 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1891 1892 1893 |
# File 'lib/textbringer/buffer.rb', line 1891 def location @location end |
Instance Method Details
#delete ⇒ Object
1903 1904 1905 1906 1907 |
# File 'lib/textbringer/buffer.rb', line 1903 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1909 1910 1911 |
# File 'lib/textbringer/buffer.rb', line 1909 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1913 1914 1915 1916 1917 1918 |
# File 'lib/textbringer/buffer.rb', line 1913 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1920 1921 1922 |
# File 'lib/textbringer/buffer.rb', line 1920 def detached? @buffer.nil? end |
#dup ⇒ Object
1924 1925 1926 1927 1928 |
# File 'lib/textbringer/buffer.rb', line 1924 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1899 1900 1901 |
# File 'lib/textbringer/buffer.rb', line 1899 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |