Sha256: 0ee43a70193fbacac3bed06df60c581c3fb30eee443d5527c6ade94bcb572f5e

Contents?: true

Size: 581 Bytes

Versions: 9

Compression:

Stored size: 581 Bytes

Contents

module Goauth2
  class ArrayResponse
    
    def initialize(response_array)
      @array = response_array
    end
    
    def each
      @array.each do |val|
        yield(wrap(val))
      end
    end
    
    def first
      wrap(@array.first)
    end
    
    def size
      @array.size
    end
    
    def length
      @array.length
    end
    
    private
      def wrap(val)
        if val.is_a? Hash
          Goauth2::HashResponse.new(val)
        elsif val.is_a? Array
          Goauth2::ArrayResponse.new(val)
        else
          val
        end
      end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
goauth2-0.0.10 lib/goauth2/array_response.rb
goauth2-0.0.9 lib/goauth2/array_response.rb
goauth2-0.0.7 lib/goauth2/array_response.rb
goauth2-0.0.6 lib/goauth2/array_response.rb
goauth2-0.0.5 lib/goauth2/array_response.rb
goauth2-0.0.4 lib/goauth2/array_response.rb
goauth2-0.0.3 lib/goauth2/array_response.rb
goauth2-0.0.2 lib/goauth2/array_response.rb
goauth2-0.0.1 lib/goauth2/array_response.rb