Skip to content

Commit

Permalink
so long multi_json, and thanks for all the fish
Browse files Browse the repository at this point in the history
  • Loading branch information
semmons99 committed Jul 20, 2012
1 parent fd65fee commit aa2a0bf
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 20 deletions.
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions lib/money/bank/variable_exchange.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'money/bank/base'

autoload :MultiJson, 'multi_json'
autoload :YAML, 'yaml'
require 'json'
require 'yaml'

class Money
module Bank
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/money/currency.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: utf-8

require 'multi_json'
require 'json'

class Money

Expand Down
2 changes: 1 addition & 1 deletion lib/money/currency_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion money.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions spec/bank/variable_exchange_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'spec_helper'
require 'multi_json'
require 'json'
require 'yaml'

describe Money::Bank::VariableExchange do
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/currency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/money/formatting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/money/parsing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit aa2a0bf

Please sign in to comment.