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

27 lines
467 B
Ruby
Raw Normal View History

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