Permalink
Browse files

so long multi_json, and thanks for all the fish

  • Loading branch information...
1 parent fd65fee commit aa2a0bfc421b9840ba0b2d1bf7a3680bd65fffa8 @semmons99 semmons99 committed Jul 18, 2012
View
2 Gemfile.lock
@@ -3,15 +3,13 @@ PATH
specs:
money (5.0.0)
i18n (~> 0.6.0)
- multi_json (~> 1.3.6)
GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.1.3)
i18n (0.6.0)
kramdown (0.13.7)
- multi_json (1.3.6)
rake (0.9.2.2)
rspec (2.10.0)
rspec-core (~> 2.10.0)
View
9 lib/money/bank/variable_exchange.rb
@@ -1,7 +1,6 @@
require 'money/bank/base'
-
-autoload :MultiJson, 'multi_json'
-autoload :YAML, 'yaml'
+require 'json'
+require 'yaml'
class Money
module Bank
@@ -186,7 +185,7 @@ def export_rates(format, file=nil)
@mutex.synchronize {
s = case format
when :json
- MultiJson.dump(@rates)
+ JSON.dump(@rates)
when :ruby
Marshal.dump(@rates)
when :yaml
@@ -224,7 +223,7 @@ def import_rates(format, s)
@mutex.synchronize {
@rates = case format
when :json
- MultiJson.load(s)
+ JSON.load(s)
when :ruby
Marshal.load(s)
when :yaml
View
2 lib/money/currency.rb
@@ -1,6 +1,6 @@
# encoding: utf-8
-require 'multi_json'
+require 'json'
class Money
View
2 lib/money/currency_loader.rb
@@ -16,6 +16,6 @@ def load_currencies
def parse_currency_file(filename)
json = File.read("#{DATA_PATH}/#{filename}")
json.force_encoding(::Encoding::UTF_8) if defined?(::Encoding)
- MultiJson.load(json, :symbolize_keys => true)
+ JSON.parse(json, :symbolize_names => true)
end
end
View
1 money.gemspec
@@ -14,7 +14,6 @@ Gem::Specification.new do |s|
s.required_rubygems_version = ">= 1.3.6"
s.add_dependency "i18n", "~> 0.6.0"
- s.add_dependency "multi_json", "~> 1.3.6"
s.add_development_dependency "rspec", "~> 2.10.0"
s.add_development_dependency "yard", "~> 0.8.1"
View
6 spec/bank/variable_exchange_spec.rb
@@ -1,5 +1,5 @@
require 'spec_helper'
-require 'multi_json'
+require 'json'
require 'yaml'
describe Money::Bank::VariableExchange do
@@ -120,7 +120,7 @@
context "with format == :json" do
it "should return rates formatted as json" do
json = subject.export_rates(:json)
- MultiJson.load(json).should == @rates
+ JSON.load(json).should == @rates
end
end
@@ -147,7 +147,7 @@
it "writes rates to file" do
f = mock('IO')
File.should_receive(:open).with('null', 'w').and_yield(f)
- f.should_receive(:write).with(MultiJson.dump(@rates))
+ f.should_receive(:write).with(JSON.dump(@rates))
subject.export_rates(:json, 'null')
end
View
4 spec/currency_spec.rb
@@ -8,7 +8,7 @@
describe ".find" do
it "returns currency matching given id" do
- Money::Currency.register(MultiJson.load(FOO, :symbolize_keys => true))
+ Money::Currency.register(JSON.parse(FOO, :symbolize_names => true))
expected = Money::Currency.new(:foo)
Money::Currency.find(:foo).should == expected
@@ -128,7 +128,7 @@
end
it "proper places for custom currency" do
- Money::Currency.register(MultiJson.load(FOO, :symbolize_keys => true))
+ Money::Currency.register(JSON.parse(FOO, :symbolize_names => true))
Money::Currency.new(:foo).decimal_places == 3
end
end
View
6 spec/money/formatting_spec.rb
@@ -285,7 +285,7 @@
describe ":south_asian_number_formatting delimiter" do
before(:each) do
- Money::Currency.register(MultiJson.load(INDIAN_BAR, :symbolize_keys => true))
+ Money::Currency.register(JSON.parse(INDIAN_BAR, :symbolize_names => true))
end
specify "(:south_asian_number_formatting => true) works as documented" do
@@ -421,8 +421,8 @@
context "custom currencies with 4 decimal places" do
before :each do
- Money::Currency.register(MultiJson.load(BAR, :symbolize_keys => true))
- Money::Currency.register(MultiJson.load(EU4, :symbolize_keys => true))
+ Money::Currency.register(JSON.parse(BAR, :symbolize_names => true))
+ Money::Currency.register(JSON.parse(EU4, :symbolize_names => true))
end
it "respects custom subunit to unit, decimal and thousands separator" do
View
4 spec/money/parsing_spec.rb
@@ -105,8 +105,8 @@
context "custom currencies with 4 decimal places" do
before :each do
- Money::Currency.register(MultiJson.load(bar, :symbolize_keys => true))
- Money::Currency.register(MultiJson.load(eu4, :symbolize_keys => true))
+ Money::Currency.register(JSON.parse(bar, :symbolize_names => true))
+ Money::Currency.register(JSON.parse(eu4, :symbolize_names => true))
end
# String#to_money(Currency) is equivalent to Money.parse(String, Currency)

0 comments on commit aa2a0bf

Please sign in to comment.