mumboe-currency 0.5 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/currency/parser.rb +4 -4
  2. metadata +7 -7
@@ -10,7 +10,7 @@ require 'rss/rss' # Time#xmlschema
10
10
  class Currency::Parser
11
11
 
12
12
  SYMBOLS_FOR_PATTERN = Currency::Currency::Factory::UNIQUE_SYMBOLS.collect {|symbol| symbol.split("").collect {|c| c =~ /[a-z]/i ? c : '\\'+c }.join }.join("|")
13
- VALID_MONEY_PATTERN = /^(([a-zA-z][a-zA-z][a-zA-z])|(#{SYMBOLS_FOR_PATTERN}))?\s*([\-\+\d,\.]+)\s*(([a-zA-z][a-zA-z][a-zA-z])|(#{SYMBOLS_FOR_PATTERN}))?(\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?Z)?$/
13
+ VALID_MONEY_PATTERN = /^(([a-zA-z][a-zA-z][a-zA-z])|(#{SYMBOLS_FOR_PATTERN}))?\s*((\d{1,3},?(\d{3},?)*\d{3}(\.\d{0,})?|\d{1,3}(\.\d{0,})?|\.\d{1,}?))\s*(([a-zA-z][a-zA-z][a-zA-z])|(#{SYMBOLS_FOR_PATTERN}))?(\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?Z)?$/
14
14
 
15
15
  # The default Currency to use if no Currency is specified.
16
16
  attr_accessor :currency
@@ -55,11 +55,11 @@ class Currency::Parser
55
55
  convert_currency = nil
56
56
  md = VALID_MONEY_PATTERN.match(x)
57
57
  if md && !@currency
58
- symbol = md[3] || md[7]
59
- code = md[2] || md[6]
58
+ symbol = md[3] || md[11]
59
+ code = md[2] || md[10]
60
60
  curr = Currency::Currency.get(code ? code.upcase : nil) || (symbol ? Currency::Currency::Factory.get_currency_from_symbol(symbol) : Currency::Currency.default)
61
61
  x = md[4]
62
- time = Time.xmlschema(md[8]) if md[8]
62
+ time = Time.xmlschema(md[12]) if md[12]
63
63
  time ||= @time
64
64
  time = Time.new if time == :now
65
65
  currency = curr
metadata CHANGED
@@ -1,20 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumboe-currency
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.5"
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
- - Mike Bradford
7
+ - "Mike Bradford (modifier: 47primes)"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-17 00:00:00 -05:00
12
+ date: 2010-01-04 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: Extended version of currency gem on RubyForge to handle all currency symbols listed on xe.com/symbols.php
17
- email: mbradford@mumboe.com
16
+ description:
17
+ email: mbradford@47primes.com
18
18
  executables:
19
19
  - currency_historical_rate_load
20
20
  extensions: []
@@ -86,5 +86,5 @@ rubygems_version: 1.3.5
86
86
  signing_key:
87
87
  specification_version: 3
88
88
  summary: Extends the RubyForge version to handle all currency symbols listed on xe.com/symbols.php.
89
- test_files: []
90
-
89
+ test_files:
90
+ - test/test_base.rb