Sha256: dac81e6046c826d93ef668ab79875a9d6a2c372cbb291e849ef5bee15294f55b

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

module Spider
    
    class Request
        attr_accessor :action, :params, :cookies, :env, :protocol,
                      :format, :extension, :session, :user_id, :server, :request_time, :controller_path,
                      :locale, :misc
                      
        BUFSIZE = 1024*4
        
        
        def initialize(env)
            Spider::Logger.debug("REQUEST:")
            Spider::Logger.debug(env)
            @env = env
            @locale = Locale.current[0]
            @misc = {}
        end
        
        def body=(b)
            @body = b
        end
        
        def body(&proc)
            b = @body.is_a?(String) ? StringIO.new(@body) : @body
            return nil unless b
            while (buf = b.read(BUFSIZE))
                yield buf
            end
        end
        
        def read_body
            return @body if @body.is_a?(String)
            b = ''
            self.body do |buf|
                b += buf
            end
            @body = b
        end
        
        # Original request path
        def path
            @action
        end
            
        
    end
    
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spiderfw-0.5.7 lib/spiderfw/controller/request.rb
spiderfw-0.5.6 lib/spiderfw/controller/request.rb
spiderfw-0.5.5 lib/spiderfw/controller/request.rb
spiderfw-0.5.4 lib/spiderfw/controller/request.rb
spiderfw-0.5.3 lib/spiderfw/controller/request.rb
spiderfw-0.5.2 lib/spiderfw/controller/request.rb
spiderfw-0.5.1 lib/spiderfw/controller/request.rb
spiderfw-0.5 lib/spiderfw/controller/request.rb