Sha256: 739db7fa907fbbe2493c9ab0b1d0eee5a96ce5b1071ce423cde3551e7b56bbee

Contents?: true

Size: 868 Bytes

Versions: 10

Compression:

Stored size: 868 Bytes

Contents

require 'net/protocol'

require 'envjs/net'

class Envjs::Net::File < Net::Protocol

  class Get
    attr_accessor :path
    def initialize path
      @path = path
    end
  end

  def initialize host, port
  end

  def self.start host, port
    new( host, port ).start
  end

  def start
    self
  end

  def finish
  end

  def request request
    Response.new request.path
  end

  class Response
    def initialize path
      @path = path
      @file = File.new @path
      @body = @file.read
      @code = @file.nil? ? "404" : "200";
      @file.close
    end

    def [] *args
      nil
    end

    def each &block
    end

    def getHeaderFields
      []
    end

    def getContentEncoding
      nil
    end

    def getResponseCode
      @file.nil? ? 404 : 200;
    end


    def getInputStream
      self
    end

    attr_reader :body, :code

  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
envjs19-0.3.8.20101029121421 lib/envjs/net/file.rb
envjs-0.3.8 lib/envjs/net/file.rb
envjs-0.3.7 lib/envjs/net/file.rb
envjs-0.3.6 lib/envjs/net/file.rb
envjs-0.3.5 lib/envjs/net/file.rb
envjs-0.3.4 lib/envjs/net/file.rb
envjs-0.3.3 lib/envjs/net/file.rb
envjs-0.3.2 lib/envjs/net/file.rb
envjs-0.3.1 lib/envjs/net/file.rb
envjs-0.3.0 lib/envjs/net/file.rb