Method: Couchbase::Datastructures::CouchbaseList#insert

Defined in:
lib/couchbase/datastructures/couchbase_list.rb

#insert(index, *obj) ⇒ CouchbaseList

Inserts the given values before the element with the given index.

Parameters:

  • index (Integer)
  • obj (Object...)

    object(s) to insert

Returns:



113
114
115
116
117
118
# File 'lib/couchbase/datastructures/couchbase_list.rb', line 113

def insert(index, *obj)
  @collection.mutate_in(@id, [
                          MutateInSpec.array_insert("[#{index.to_i}]", obj),
                        ])
  self
end