Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
phlegx committed Sep 2, 2015
2 parents 42e079f + 66644af commit b8ffc25
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
32 changes: 32 additions & 0 deletions config/currency_non_iso.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,37 @@
"thousands_separator": ",",
"iso_numeric": "",
"smallest_denomination": 1
},
"ggp": {
"priority": 100,
"iso_code": "GGP",
"name": "Guernsey Pound",
"symbol": "£",
"disambiguate_symbol": "GGP",
"alternate_symbols": [],
"subunit": "Penny",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "",
"smallest_denomination": 1
},
"imp": {
"priority": 100,
"iso_code": "IMP",
"name": "Isle of Man Pound",
"symbol": "£",
"disambiguate_symbol": "IMP",
"alternate_symbols": [""],
"subunit": "Penny",
"subunit_to_unit": 100,
"symbol_first": true,
"html_entity": "£",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "",
"smallest_denomination": 1
}
}
2 changes: 1 addition & 1 deletion lib/money/currency/heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def currencies_by_iso_code
def currencies_by_name
{}.tap do |r|
table.each do |dummy,c|
name_parts = c[:name].downcase.split
name_parts = I18n.transliterate(c[:name]).downcase.split
name_parts.each {|part| part.chomp!('.')}

# construct one branch per word
Expand Down
4 changes: 4 additions & 0 deletions spec/currency/heuristics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
expect(it.analyze("10EUR is less than 100:- but really, I want US$1")).to eq ['EUR', 'SEK', 'USD']
end

it "find currencies with special characters in name using transliterate" do
expect(it.analyze("10 Nicaraguan Cordoba")).to eq ["NIO"]
end

it "should function with unicode characters" do
expect(it.analyze("10 դր.")).to eq ["AMD"]
end
Expand Down

0 comments on commit b8ffc25

Please sign in to comment.