Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

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

Merged
merged 2 commits into from Aug 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/sinatra/json.rb
@@ -1,5 +1,5 @@
require 'sinatra/base' require 'sinatra/base'

require 'multi_json'
module Sinatra module Sinatra


# = Sinatra::JSON # = Sinatra::JSON
Expand Down Expand Up @@ -32,7 +32,6 @@ module Sinatra
# require "sinatra/json" # require "sinatra/json"
# #
# class MyApp < Sinatra::Base # class MyApp < Sinatra::Base
# helpers Sinatra::JSON
# #
# # define a route that uses the helper # # define a route that uses the helper
# get '/' do # get '/' do
Expand Down Expand Up @@ -126,5 +125,7 @@ def resolve_encoder_action(object, encoder)
end end


Base.set :json_content_type, :json Base.set :json_content_type, :json
helpers JSON
# Load the JSON helpers in modular style automatically
Base.helpers JSON
end end
2 changes: 2 additions & 0 deletions sinatra-contrib.gemspec
Expand Up @@ -118,10 +118,12 @@ Gem::Specification.new do |s|
s.add_dependency "rack-test" s.add_dependency "rack-test"
s.add_dependency "rack-protection" s.add_dependency "rack-protection"
s.add_dependency "eventmachine" s.add_dependency "eventmachine"
s.add_dependency "multi_json"


s.add_development_dependency "rspec", "~> 2.3" s.add_development_dependency "rspec", "~> 2.3"
s.add_development_dependency "haml" s.add_development_dependency "haml"
s.add_development_dependency "erubis" s.add_development_dependency "erubis"
s.add_development_dependency "slim" s.add_development_dependency "slim"
s.add_development_dependency "rake" s.add_development_dependency "rake"
s.add_development_dependency "yajl-ruby"
end end
1 change: 0 additions & 1 deletion spec/json_spec.rb
Expand Up @@ -33,7 +33,6 @@
describe Sinatra::JSON do describe Sinatra::JSON do
def mock_app(&block) def mock_app(&block)
super do super do
helpers Sinatra::JSON
class_eval(&block) class_eval(&block)
end end
end end
Expand Down