Sha256: c96b8455f36b9ebd77c9f8da4475326011f464b2b8a2acd90747e64cbdc3d82b

Contents?: true

Size: 476 Bytes

Versions: 1

Compression:

Stored size: 476 Bytes

Contents

module RestMan
  module Payload
    class Streamed < Base
      def build_stream(params = nil)
        @stream = params
      end

      def size
        if @stream.respond_to?(:size)
          @stream.size
        elsif @stream.is_a?(IO)
          @stream.stat.size
        end
      end

      # TODO (breaks compatibility): ought to use mime_for() to autodetect the
      # Content-Type for stream objects that have a filename.

      alias :length :size
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rest-man-1.1.0 lib/restman/payload/streamed.rb