Sha256: adc2725034353cb48f3cb8acfe7cc1d795e95da3a887bf4a4bc71fbc3ca53bf2
Contents?: true
Size: 1.46 KB
Versions: 5
Compression:
Stored size: 1.46 KB
Contents
module Vedeu module Editor # Manipulate the lines of an Vedeu::Editor::Document. # class Insert # @return [Vedeu::Editor::Line|Vedeu::Editor::Lines] # @see #initialize def self.into(collection, entity, index = nil, size = 0) new(collection, entity, index, size).insert end # Returns a new instance of Vedeu::Editor::Insert. # # @param collection [Vedeu::Editor::Line|Vedeu::Editor::Lines] # @param entity [String] # @param index [Fixnum] # @param size [Fixnum] # @return [Vedeu::Editor::Insert] def initialize(collection, entity, index = nil, size = 0) @collection = collection @entity = entity @index = index @size = size end # @return [Vedeu::Editor::Line|Vedeu::Editor::Lines] def insert return collection.insert(index, entity) if index collection << entity end protected # @!attribute [r] collection # @return [Vedeu::Editor::Line|Vedeu::Editor::Lines] attr_reader :collection # @!attribute [r] entity # @return [String] attr_reader :entity # @!attribute [r] size # @return [Fixnum] attr_reader :size private # @return [Fixnum] def index return nil unless @index @index = 0 if @index < 0 @index = size if @index > size @index end end # Insert end # Editor end # Vedeu
Version data entries
5 entries across 5 versions & 1 rubygems