1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/vendor/responder/lib/responder.rb
blake.mizerany@gmail.com 49da7fc4c7 * silence warnings or reload
* simple responder
* update examples
2007-09-12 06:56:31 +00:00

27 lines
No EOL
467 B
Ruby

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