Class: Vedeu::Editor::Line Private
- Inherits:
-
Object
- Object
- Vedeu::Editor::Line
- Extended by:
- Forwardable
- Includes:
- Collection
- Defined in:
- lib/vedeu/editor/line.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Manipulate a single line of an Vedeu::Editor::Document.
Instance Attribute Summary collapse
- #collection ⇒ String (also: #line, #to_s)
Instance Method Summary collapse
-
#character(index = nil) ⇒ String|NilClass
private
Return the character at the given index.
-
#delete_character(index = nil) ⇒ String
private
Delete the character from the line positioned at the given index.
-
#initialize(collection = nil) ⇒ Vedeu::Editor::Line
constructor
private
Returns a new instance of Vedeu::Editor::Line.
-
#insert_character(character, index = nil) ⇒ Vedeu::Editor::Line
private
Insert the character on the line positioned at the given index.
Methods included from Collection
Methods included from Repositories::Assemblage
#[], #any?, #each, #empty?, #eql?, #size
Constructor Details
#initialize(collection = nil) ⇒ Vedeu::Editor::Line
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Vedeu::Editor::Line.
34 35 36 |
# File 'lib/vedeu/editor/line.rb', line 34 def initialize(collection = nil) @collection = collection || '' end |
Instance Attribute Details
#collection ⇒ String Also known as: line, to_s
17 18 19 |
# File 'lib/vedeu/editor/line.rb', line 17 def collection @collection end |
Instance Method Details
#character(index = nil) ⇒ String|NilClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the character at the given index.
42 43 44 45 46 47 |
# File 'lib/vedeu/editor/line.rb', line 42 def character(index = nil) return '' if collection && collection.empty? return collection[-1] unless index by_index(index) end |
#delete_character(index = nil) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Delete the character from the line positioned at the given index.
54 55 56 57 |
# File 'lib/vedeu/editor/line.rb', line 54 def delete_character(index = nil) Vedeu::Editor::Line.coerce(Vedeu::Editor::Delete .from(line, index, size)) end |
#insert_character(character, index = nil) ⇒ Vedeu::Editor::Line
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Insert the character on the line positioned at the given index.
65 66 67 68 69 70 |
# File 'lib/vedeu/editor/line.rb', line 65 def insert_character(character, index = nil) return self unless character Vedeu::Editor::Line.coerce(Vedeu::Editor::Insert .into(collection, character, index, size)) end |