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
1912 1913 1914 1915 1916 |
# File 'lib/textbringer/buffer.rb', line 1912 def initialize(buffer, location) @buffer = buffer @file_name = nil @location = location end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
1909 1910 1911 |
# File 'lib/textbringer/buffer.rb', line 1909 def buffer @buffer end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
1909 1910 1911 |
# File 'lib/textbringer/buffer.rb', line 1909 def file_name @file_name end |
#location ⇒ Object
Returns the value of attribute location.
1910 1911 1912 |
# File 'lib/textbringer/buffer.rb', line 1910 def location @location end |
Instance Method Details
#delete ⇒ Object
1922 1923 1924 1925 1926 |
# File 'lib/textbringer/buffer.rb', line 1922 def delete if @buffer @buffer.marks.delete(self) end end |
#deleted? ⇒ Boolean
1928 1929 1930 |
# File 'lib/textbringer/buffer.rb', line 1928 def deleted? !@buffer.marks.include?(self) end |
#detach ⇒ Object
1932 1933 1934 1935 1936 1937 |
# File 'lib/textbringer/buffer.rb', line 1932 def detach if @buffer @file_name = @buffer.file_name @buffer = nil end end |
#detached? ⇒ Boolean
1939 1940 1941 |
# File 'lib/textbringer/buffer.rb', line 1939 def detached? @buffer.nil? end |
#dup ⇒ Object
1943 1944 1945 1946 1947 |
# File 'lib/textbringer/buffer.rb', line 1943 def dup mark = @buffer.new_mark mark.location = @location mark end |
#inspect ⇒ Object
1918 1919 1920 |
# File 'lib/textbringer/buffer.rb', line 1918 def inspect "#<Mark:#{@buffer&.name || @file_name}:#{@location}>" end |