Sha256: f0845b31d86978b29a5dd20f04de081900bb088ed377aade5f77ef390c7b9f75

Contents?: true

Size: 403 Bytes

Versions: 2

Compression:

Stored size: 403 Bytes

Contents

module Hcloud
  class MultiReply
    include Enumerable
    attr_accessor :cb

    def initialize(j:, pagination: nil)
       @j = j
       @pagination = pagination
    end

    def pagination
      @pagination || Pagination.new(@j.first.to_h["meta"].to_h["pagination"], nil, nil)
    end

    def each(&block)
      @cb.call(@j).each do |member|
        block.call(member)
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hcloud-0.1.1 lib/hcloud/multi_reply.rb
hcloud-0.1.0 lib/hcloud/multi_reply.rb