lib/sinatra/respond_with.rb in sinatra-contrib-1.4.0 vs lib/sinatra/respond_with.rb in sinatra-contrib-1.4.1
- old
+ new
@@ -12,11 +12,11 @@
#
# # Without Sinatra::RespondWith
# get '/' do
# data = { :name => 'example' }
# request.accept.each do |type|
- # case type
+ # case type.to_s
# when 'text/html'
# halt haml(:index, :locals => data)
# when 'text/json'
# halt data.to_json
# when 'application/atom+xml'
@@ -182,12 +182,10 @@
end
[] # nil or false would not be cached
end
end
- attr_accessor :ext_map
-
def remap_extensions
ext_map.clear
Rack::Mime::MIME_TYPES.each { |e,t| ext_map[t] << e[1..-1].to_sym }
ext_map['text/javascript'] << 'js'
ext_map['text/xml'] << 'xml'
@@ -235,10 +233,10 @@
}
ENGINES.default = []
def self.registered(base)
- base.ext_map = Hash.new { |h,k| h[k] = [] }
+ base.set :ext_map, Hash.new { |h,k| h[k] = [] }
base.set :template_engines, ENGINES.dup
base.remap_extensions
base.helpers Helpers
end
end