Class: Yoda::Store::Objects::Merger::PendingArray

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/yoda/store/objects/merger.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(els) ⇒ PendingArray

Returns a new instance of PendingArray.

Parameters:

  • els (Array<Object>)


134
135
136
# File 'lib/yoda/store/objects/merger.rb', line 134

def initialize(els)
  @array = els.dup
end

Instance Attribute Details

#arrayArray<Object> (readonly)

Returns:

  • (Array<Object>)


129
130
131
# File 'lib/yoda/store/objects/merger.rb', line 129

def array
  @array
end

Class Method Details

.append(els, *others) ⇒ Object

Parameters:



120
121
122
123
124
125
126
# File 'lib/yoda/store/objects/merger.rb', line 120

def self.append(els, *others)
  if els.is_a?(PendingArray)
    others.reduce(els) { |array, item| array.append(item) }
  else
    append(PendingArray.new(els), *others)
  end
end

Instance Method Details

#append(els) ⇒ Object

Parameters:

  • els (Array<Object>)


139
140
141
142
# File 'lib/yoda/store/objects/merger.rb', line 139

def append(els)
  array.push(*els)
  self
end