mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
don't worry about this for now
This commit is contained in:
parent
0302501212
commit
f5c532306e
3 changed files with 0 additions and 43 deletions
3
vendor/responder/init.rb
vendored
3
vendor/responder/init.rb
vendored
|
@ -1,3 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/lib/responder'
|
||||
|
||||
Sinatra::EventContext.send(:include, Sinatra::Responder)
|
27
vendor/responder/lib/responder.rb
vendored
27
vendor/responder/lib/responder.rb
vendored
|
@ -1,27 +0,0 @@
|
|||
module Sinatra
|
||||
|
||||
module Responder
|
||||
|
||||
def self.included(parent)
|
||||
parent.send(:include, InstanceMethods)
|
||||
end
|
||||
|
||||
class ResponderContext
|
||||
def initialize(format)
|
||||
@format = format
|
||||
end
|
||||
|
||||
def method_missing(name, *args)
|
||||
yield if name.to_s == @format
|
||||
end
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def format
|
||||
@responder_context ||= ResponderContext.new(params[:format])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
13
vendor/responder/test/responder_test.rb
vendored
13
vendor/responder/test/responder_test.rb
vendored
|
@ -1,13 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/../../../test/helper'
|
||||
|
||||
context "A responder, by default" do
|
||||
specify "should default to html" do
|
||||
path = '/foo/test.xml'
|
||||
context = Sinatra::EventContext.new(stub(:params => { :format => 'xml' }))
|
||||
context.expects(:foo)
|
||||
context.instance_eval do
|
||||
format.xml { foo }
|
||||
format.html { bar }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue