Class: Vedeu::Editor::Insert Private
- Inherits:
-
Object
- Object
- Vedeu::Editor::Insert
- Defined in:
- lib/vedeu/editor/insert.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 the lines of an Vedeu::Editor::Document.
Instance Attribute Summary collapse
- #collection ⇒ Vedeu::Editor::Line|Vedeu::Editor::Lines readonly protected private
- #entity ⇒ String readonly protected private
- #size ⇒ Fixnum readonly protected private
Class Method Summary collapse
Instance Method Summary collapse
- #index ⇒ Fixnum private private
-
#initialize(collection, entity, index = nil, size = 0) ⇒ Vedeu::Editor::Insert
constructor
private
Returns a new instance of Vedeu::Editor::Insert.
- #insert ⇒ Vedeu::Editor::Line|Vedeu::Editor::Lines private
Constructor Details
#initialize(collection, entity, index = nil, size = 0) ⇒ Vedeu::Editor::Insert
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::Insert.
24 25 26 27 28 29 |
# File 'lib/vedeu/editor/insert.rb', line 24 def initialize(collection, entity, index = nil, size = 0) @collection = collection @entity = entity @index = index @size = size end |
Instance Attribute Details
#collection ⇒ Vedeu::Editor::Line|Vedeu::Editor::Lines (readonly, protected)
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.
42 43 44 |
# File 'lib/vedeu/editor/insert.rb', line 42 def collection @collection end |
#entity ⇒ String (readonly, protected)
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.
46 47 48 |
# File 'lib/vedeu/editor/insert.rb', line 46 def entity @entity end |
#size ⇒ Fixnum (readonly, protected)
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.
50 51 52 |
# File 'lib/vedeu/editor/insert.rb', line 50 def size @size end |
Class Method Details
.into(collection, entity, index = nil, size = 0) ⇒ Vedeu::Editor::Line|Vedeu::Editor::Lines
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.
13 14 15 |
# File 'lib/vedeu/editor/insert.rb', line 13 def self.into(collection, entity, index = nil, size = 0) new(collection, entity, index, size).insert end |
Instance Method Details
#index ⇒ Fixnum (private)
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.
55 56 57 58 59 60 61 |
# File 'lib/vedeu/editor/insert.rb', line 55 def index return nil unless @index @index = 0 if @index < 0 @index = size if @index > size @index end |
#insert ⇒ Vedeu::Editor::Line|Vedeu::Editor::Lines
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.
32 33 34 35 36 |
# File 'lib/vedeu/editor/insert.rb', line 32 def insert return collection.insert(index, entity) if index collection << entity end |