Kiss A simpler, smarter web application framework for Ruby

Rack::Facebook Subclass of Object

Methods

Description

Rack::Facebook formats HTTP responses to remove certain status codes and HTML entities that are invalid as FBML responses.

Public Class Methods

new(app) source

Not documented

    # File lib/kiss/rack/facebook.rb, line 5
    def initialize(app)
      @app = app
    end
    

Public Instance Methods

call(env) source

Not documented

    # File lib/kiss/rack/facebook.rb, line 9
    def call(env)
      code, headers, body = @app.call(env)
      
      if code >= 500 && code < 600
        code = 200
      end
      
      contents = ''
      body.each {|p| contents += p }
      
      contents.gsub!(/txmt:\/\//, 'http://textmate.local/')
      contents.gsub!('<body>','<div class="body">')
      contents.gsub!('</body>','</div>')
      contents.gsub!('<wbr/>','')
      
      headers['Content-Length'] = contents.length.to_s
      
      [ code, headers, contents ]
    end
    

Disabled; run with $DEBUG to generate this.