Adds multi_json gem as a dependency and loads it automatically #96

Merged
merged 2 commits into from Aug 16, 2013
View
7 lib/sinatra/json.rb
@@ -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
2 sinatra-contrib.gemspec
@@ -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
View
1 spec/json_spec.rb
@@ -33,7 +33,6 @@
describe Sinatra::JSON do
def mock_app(&block)
super do
- helpers Sinatra::JSON
class_eval(&block)
end
end