Method: Ohm::Collection#fetch

Defined in:
lib/ohm.rb

#fetch(ids) ⇒ Object

Wraps the whole pipelining functionality.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/ohm.rb', line 140

def fetch(ids)
  data = nil

  model.synchronize do
    ids.each do |id|
      redis.queue("HGETALL", namespace[id])
    end

    data = redis.commit
  end

  return [] if data.nil?

  [].tap do |result|
    data.each_with_index do |atts, idx|
      result << model.new(Utils.dict(atts).update(:id => ids[idx]))
    end
  end
end