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>)


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

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

Instance Attribute Details

#arrayArray<Object> (readonly)

Returns:

  • (Array<Object>)


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

def array
  @array
end

Class Method Details

.append(els, *others) ⇒ Object

Parameters:



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

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>)


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

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