Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added deprecation error for heuristics module
  • Loading branch information
stereobooster committed Mar 14, 2017
1 parent faaeb15 commit 44e4e0d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/money/currency.rb
Expand Up @@ -2,6 +2,7 @@

require "json"
require "money/currency/loader"
require "money/currency/heuristics"

class Money

Expand All @@ -13,6 +14,7 @@ class Currency
include Comparable
extend Enumerable
extend Money::Currency::Loader
extend Money::Currency::Heuristics

# Keeping cached instances in sync between threads
@@mutex = Mutex.new
Expand Down
11 changes: 11 additions & 0 deletions lib/money/currency/heuristics.rb
@@ -0,0 +1,11 @@
# encoding: utf-8

class Money
class Currency
module Heuristics
def analyze(str)
raise StandardError, 'Heuristics deprecated, add `gem "money-heuristics"` to Gemfile'
end
end
end
end
11 changes: 11 additions & 0 deletions spec/currency/heuristics_spec.rb
@@ -0,0 +1,11 @@
# encoding: utf-8

describe Money::Currency::Heuristics do
describe "#analyze_string" do
let(:it) { Money::Currency }

it "it raises deprecation error" do
expect{ it.analyze('123') }.to raise_error(StandardError, 'Heuristics deprecated, add `gem "money-heuristics"` to Gemfile')
end
end
end

0 comments on commit 44e4e0d

Please sign in to comment.