currency_parser 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE → MIT-LICENSE} +0 -0
- data/README.md +69 -2
- data/lib/currency_parser/version.rb +1 -1
- metadata +46 -41
- checksums.yaml +0 -15
data/{LICENSE → MIT-LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,2 +1,69 @@
|
|
1
|
-
currency_parser
|
2
|
-
|
1
|
+
# currency_parser
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your Rails 3.x application's Gemfile:
|
6
|
+
|
7
|
+
```
|
8
|
+
gem 'currency_parser'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
```
|
14
|
+
$ bundle
|
15
|
+
```
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
```
|
20
|
+
$ gem install CorePlugin
|
21
|
+
```
|
22
|
+
|
23
|
+
## API Summary
|
24
|
+
|
25
|
+
`CurrencyParser` works in any Ruby class, it does not require Active
|
26
|
+
Record or other ORM. Its default settings has it configured for the
|
27
|
+
German currency format, without allowing negative values.
|
28
|
+
|
29
|
+
```
|
30
|
+
parser = CurrencyParser::Parser.new
|
31
|
+
=> #<CurrencyParser::Parser:0x007feca487fe68
|
32
|
+
@allow_negative=false,
|
33
|
+
@delimiter=".",
|
34
|
+
@format=:de,
|
35
|
+
@separator=",">
|
36
|
+
|
37
|
+
parser.to_us("1,23")
|
38
|
+
=> "1.23"
|
39
|
+
|
40
|
+
parser.to_us("-1,23")
|
41
|
+
=> "1.23"
|
42
|
+
```
|
43
|
+
|
44
|
+
The same can be achieved without any change to the default configuration
|
45
|
+
via
|
46
|
+
|
47
|
+
```
|
48
|
+
CurrencyParser::Parser.to_us("1,23")
|
49
|
+
=> "1.23"
|
50
|
+
```
|
51
|
+
|
52
|
+
As of v0.1.2 only the **`:de`** format is supported and you can allow
|
53
|
+
negative values as follows
|
54
|
+
|
55
|
+
```
|
56
|
+
parser = CurrencyParser::Parser.new(:de, :allow_negative => true)
|
57
|
+
=> #<CurrencyParser::Parser:0x007feca9f999d8
|
58
|
+
@allow_negative=true,
|
59
|
+
@delimiter=".",
|
60
|
+
@format=:de,
|
61
|
+
@separator=",">
|
62
|
+
|
63
|
+
parser.to_us("-1,23")
|
64
|
+
=> "-1.23"
|
65
|
+
```
|
66
|
+
|
67
|
+
## License
|
68
|
+
|
69
|
+
This project rocks and uses MIT-LICENSE.
|
metadata
CHANGED
@@ -1,127 +1,128 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currency_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.2
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Michael de Silva
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.2.13
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
15
|
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
none: false
|
23
17
|
requirements:
|
24
18
|
- - ~>
|
25
19
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3
|
27
|
-
|
28
|
-
|
20
|
+
version: '1.3'
|
21
|
+
name: bundler
|
22
|
+
prerelease: false
|
29
23
|
requirement: !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
30
25
|
requirements:
|
31
|
-
- -
|
26
|
+
- - ~>
|
32
27
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
28
|
+
version: '1.3'
|
34
29
|
type: :development
|
35
|
-
|
30
|
+
- !ruby/object:Gem::Dependency
|
36
31
|
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
37
33
|
requirements:
|
38
34
|
- - ! '>='
|
39
35
|
- !ruby/object:Gem::Version
|
40
36
|
version: '0'
|
41
|
-
|
42
|
-
|
37
|
+
name: rake
|
38
|
+
prerelease: false
|
43
39
|
requirement: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
44
41
|
requirements:
|
45
42
|
- - ! '>='
|
46
43
|
- !ruby/object:Gem::Version
|
47
44
|
version: '0'
|
48
45
|
type: :development
|
49
|
-
|
46
|
+
- !ruby/object:Gem::Dependency
|
50
47
|
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
51
49
|
requirements:
|
52
50
|
- - ! '>='
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: '0'
|
55
|
-
|
56
|
-
|
53
|
+
name: rspec
|
54
|
+
prerelease: false
|
57
55
|
requirement: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
58
57
|
requirements:
|
59
58
|
- - ! '>='
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '0'
|
62
61
|
type: :development
|
63
|
-
|
62
|
+
- !ruby/object:Gem::Dependency
|
64
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
65
|
requirements:
|
66
66
|
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
|
70
|
-
|
69
|
+
name: pry
|
70
|
+
prerelease: false
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
72
73
|
requirements:
|
73
74
|
- - ! '>='
|
74
75
|
- !ruby/object:Gem::Version
|
75
76
|
version: '0'
|
76
77
|
type: :development
|
77
|
-
|
78
|
+
- !ruby/object:Gem::Dependency
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
79
81
|
requirements:
|
80
82
|
- - ! '>='
|
81
83
|
- !ruby/object:Gem::Version
|
82
84
|
version: '0'
|
83
|
-
|
84
|
-
|
85
|
+
name: mocha
|
86
|
+
prerelease: false
|
85
87
|
requirement: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
86
89
|
requirements:
|
87
90
|
- - ! '>='
|
88
91
|
- !ruby/object:Gem::Version
|
89
92
|
version: '0'
|
90
93
|
type: :development
|
91
|
-
|
94
|
+
- !ruby/object:Gem::Dependency
|
92
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
93
97
|
requirements:
|
94
98
|
- - ! '>='
|
95
99
|
- !ruby/object:Gem::Version
|
96
100
|
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
101
|
name: guard-rspec
|
102
|
+
prerelease: false
|
99
103
|
requirement: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
100
105
|
requirements:
|
101
106
|
- - ! '>='
|
102
107
|
- !ruby/object:Gem::Version
|
103
108
|
version: '0'
|
104
109
|
type: :development
|
105
|
-
|
110
|
+
- !ruby/object:Gem::Dependency
|
106
111
|
version_requirements: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
107
113
|
requirements:
|
108
114
|
- - ! '>='
|
109
115
|
- !ruby/object:Gem::Version
|
110
116
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
117
|
name: yard
|
118
|
+
prerelease: false
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
114
121
|
requirements:
|
115
122
|
- - ! '>='
|
116
123
|
- !ruby/object:Gem::Version
|
117
124
|
version: '0'
|
118
125
|
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ! '>='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
126
|
description: Parse strings formatted as currencies
|
126
127
|
email:
|
127
128
|
- michael@mwdesilva.com
|
@@ -131,32 +132,36 @@ extra_rdoc_files: []
|
|
131
132
|
files:
|
132
133
|
- lib/currency_parser/version.rb
|
133
134
|
- lib/currency_parser.rb
|
134
|
-
- LICENSE
|
135
|
+
- MIT-LICENSE
|
135
136
|
- Rakefile
|
136
137
|
- README.md
|
137
138
|
homepage: http://mwdesilva.com
|
138
139
|
licenses:
|
139
140
|
- MIT
|
140
|
-
metadata: {}
|
141
141
|
post_install_message:
|
142
142
|
rdoc_options: []
|
143
143
|
require_paths:
|
144
144
|
- lib
|
145
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
146
147
|
requirements:
|
147
148
|
- - ! '>='
|
148
149
|
- !ruby/object:Gem::Version
|
149
150
|
version: 1.9.3
|
150
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
151
153
|
requirements:
|
152
154
|
- - ! '>='
|
153
155
|
- !ruby/object:Gem::Version
|
156
|
+
segments:
|
157
|
+
- 0
|
158
|
+
hash: -841931737946713732
|
154
159
|
version: '0'
|
155
160
|
requirements: []
|
156
161
|
rubyforge_project:
|
157
|
-
rubygems_version:
|
162
|
+
rubygems_version: 1.8.24
|
158
163
|
signing_key:
|
159
|
-
specification_version:
|
164
|
+
specification_version: 3
|
160
165
|
summary: Parse strings formatted as currencies
|
161
166
|
test_files: []
|
162
167
|
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
YjAwOWUzMDVjNGIyZTc2NDA5Njk1NjE5NWYxODYyNjQyNWQ4YTA5NQ==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MTQ1MTlkZjYzOWI5MmZlZDkxMTZhZjRiNGRlMjdmN2RlNTU3ZjBhZA==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NmViZDQ2NjY0Yzc2MDhjZWRiMzNkODk5NGEzYzRjNzIzYWM5MjFmNDViOTE3
|
10
|
-
Y2FkM2U3MGI5ZWVkODBhYWM0YTc3MzQwNWJmZTY5YzUxZWY5OTkyMDYzZDQz
|
11
|
-
OWNiY2UxM2MzMjA2ZjAxYjNhYzg3ZjIwNjllNjQ4MDc2OTA1YmE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZWI0NjFjN2M4M2FhOTQ4ZmE5OWMyZjg1NmRhNDllNjI1ZDMxYTNhODRhMTBj
|
14
|
-
Nzg2N2IzMzlkODE4NzA0MzA0YjFhMmJjMzQxZGE5YmE1OTMwODcyYWZkNDU2
|
15
|
-
MmY2YWEzZjQ2ZGI5NDUyYzNkOTg3M2I1MTE1YjYzOTg4MTg3ZGU=
|