From 4e1fffc0613cac72e967f9423b96e85a29be863d Mon Sep 17 00:00:00 2001 From: "blake.mizerany@gmail.com" Date: Tue, 11 Sep 2007 23:16:38 +0000 Subject: [PATCH] taking out for now --- vendor/respond_to/README | 17 ---------- vendor/respond_to/init.rb | 5 --- vendor/respond_to/lib/responder.rb | 63 -------------------------------------- 3 files changed, 85 deletions(-) delete mode 100644 vendor/respond_to/README delete mode 100644 vendor/respond_to/init.rb delete mode 100644 vendor/respond_to/lib/responder.rb diff --git a/vendor/respond_to/README b/vendor/respond_to/README deleted file mode 100644 index cf45316..0000000 --- a/vendor/respond_to/README +++ /dev/null @@ -1,17 +0,0 @@ -Respond_to - -Allows for different methods to be called upon in the event context block - -from - -get 'index' do - body "hey" -end - -to - -get 'index' do - html {"hi"} -end - -If there is a block with the extension, that will be used as the output, otherwise the body of the block will be used. diff --git a/vendor/respond_to/init.rb b/vendor/respond_to/init.rb deleted file mode 100644 index ee5bdc1..0000000 --- a/vendor/respond_to/init.rb +++ /dev/null @@ -1,5 +0,0 @@ -require File.dirname(__FILE__) + '/lib/responder' - -Sinatra::EventContext.send(:include, Sinatra::Responder) -Sinatra::Event.send(:include, Sinatra::EventResponder) -Sinatra::EventManager.send(:extend, Sinatra::DispatcherResponder) diff --git a/vendor/respond_to/lib/responder.rb b/vendor/respond_to/lib/responder.rb deleted file mode 100644 index 67c2fa8..0000000 --- a/vendor/respond_to/lib/responder.rb +++ /dev/null @@ -1,63 +0,0 @@ -module Sinatra - module Responder - - module InstanceMethods - def method_missing(id, *args, &block) - if block - @responds_to[id] = block unless @responds_to.has_key? id - else - super - end - end - def initialize_with_responds_to(i) - initialize_without_responds_to(i) - @responds_to = {} - end - end - - def self.included(base) - base.send :include, InstanceMethods - base.instance_eval do - alias_method :initialize_without_responds_to, :initialize - alias_method :initialize, :initialize_with_responds_to - end - attr_accessor :responds_to - end - end - module EventResponder - def self.included(base) - base.send :include, InstanceMethods - base.instance_eval do - alias_method :attend_without_respond_to, :attend - alias_method :attend, :attend_with_respond_to - end - end - module InstanceMethods - # Pulls the request info from the REQUEST_PATH - # it looks for the path extension - # For instance, index.html will respond to the html block - def respond_request(request) - request.env['REQUEST_PATH'].include?('.') ? request.env['REQUEST_PATH'].split('.')[-1].to_sym : :html - end - def attend_with_respond_to(request) - context = EventContext.new(request) - begin - context.instance_eval(&@block) if @block - context.responds_to[respond_request(request)].call if context.responds_to.has_key? respond_request(request) - rescue => e - context.error e - end - run_through_after_filters(context) - context - end - end - end - - module DispatcherResponder - def determine_event(verb, path) - EventManager.events.detect(method(:not_found)) do |e| - e.path =~ Regexp.new(path.split(".")[0..-2].join("|").gsub(/\//, '')) && e.verb == verb - end - end - end -end -- 2.11.4.GIT