lib/sinatra/json.rb in sinatra-contrib-1.4.0 vs lib/sinatra/json.rb in sinatra-contrib-1.4.1
- old
+ new
@@ -1,7 +1,7 @@
require 'sinatra/base'
-
+require 'multi_json'
module Sinatra
# = Sinatra::JSON
#
# <tt>Sinatra::JSON</tt> adds a helper method, called +json+, for (obviously)
@@ -30,11 +30,10 @@
#
# require "sinatra/base"
# require "sinatra/json"
#
# class MyApp < Sinatra::Base
- # helpers Sinatra::JSON
#
# # define a route that uses the helper
# get '/' do
# json :foo => 'bar'
# end
@@ -124,7 +123,9 @@
Base.set :json_encoder do
::MultiJson
end
Base.set :json_content_type, :json
- helpers JSON
+
+ # Load the JSON helpers in modular style automatically
+ Base.helpers JSON
end