Permalink
Browse files

Adds multi_json gem as a dependency and loads it automatically

* Loads the "multi_json" gem automatically so that the user need not
* bother

* Loads the helpers automatically in modular-style apps. These are
* loaded automatically in classic style code (check
* lib/sinatra/contrib.rb) and this change preserves consistency of
* style.

* Adds multi_json gem as dependency. Some tests fails since "yajl-ruby"
* is used. This is added as a development dependency.
  • Loading branch information...
kgrz committed Mar 29, 2013
1 parent 639acf8 commit 89e88b51db08ec63ed4ce9579dd0274bf903e3d2
Showing with 6 additions and 3 deletions.
  1. +4 −3 lib/sinatra/json.rb
  2. +2 −0 sinatra-contrib.gemspec
View
@@ -1,5 +1,5 @@
require 'sinatra/base'
-
+require 'multi_json'
module Sinatra
# = Sinatra::JSON
@@ -32,7 +32,6 @@ module Sinatra
# require "sinatra/json"
#
# class MyApp < Sinatra::Base
- # helpers Sinatra::JSON
#
# # define a route that uses the helper
# get '/' do
@@ -126,5 +125,7 @@ def resolve_encoder_action(object, encoder)
end
Base.set :json_content_type, :json
- helpers JSON
+
+ # Load the JSON helpers in modular style automatically
+ Base.helpers JSON
end
View
@@ -118,10 +118,12 @@ Gem::Specification.new do |s|
s.add_dependency "rack-test"
s.add_dependency "rack-protection"
s.add_dependency "eventmachine"
+ s.add_dependency "multi_json"
s.add_development_dependency "rspec", "~> 2.3"
s.add_development_dependency "haml"
s.add_development_dependency "erubis"
s.add_development_dependency "slim"
s.add_development_dependency "rake"
+ s.add_development_dependency "yajl-ruby"
end

0 comments on commit 89e88b5

Please sign in to comment.