Sha256: ca5c869ba0827e39cdb9b884b4bdec1e3c929c27b737de283d3b6c7317526d06

Contents?: true

Size: 582 Bytes

Versions: 3

Compression:

Stored size: 582 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

3 entries across 3 versions & 1 rubygems

Version Path
goauth2-0.0.13 lib/goauth2/array_response.rb
goauth2-0.0.12 lib/goauth2/array_response.rb
goauth2-0.0.11 lib/goauth2/array_response.rb