Sha256: 95267814756bb4a0097a5cb692874b7098294ee9447c28981de661fc504343b6
Contents?: true
Size: 778 Bytes
Versions: 8
Compression:
Stored size: 778 Bytes
Contents
module Eucalyptus class Response < OpenStruct # extend OpenStruct to work with nested hashes def initialize(hash) @table = {} @hash_table = {} hash.each do |k, v| @table[k.to_sym] = (v.is_a?(Hash) ? self.class.new(v) : v) @hash_table[k.to_sym] = v new_ostruct_member(k) end end end class ResponseCollection < Array def initialize(klass, koala_response) @koala_response = koala_response @klass = klass self.concat elements(@koala_response) end def next_page next_p = @koala_response.next_page if next_p self.class.new(@klass, next_p) end end private def elements(response) response.collect{ |res| @klass.new(res) } end end end
Version data entries
8 entries across 8 versions & 1 rubygems