currencies 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +15 -5
- data/.rvmrc +1 -1
- data/Gemfile +4 -5
- data/Gemfile.lock +21 -13
- data/LICENSE +3 -1
- data/README.markdown +1 -1
- data/Rakefile +8 -39
- data/currencies.gemspec +15 -62
- data/lib/currencies.rb +1 -1
- data/lib/currencies/version.rb +3 -0
- data/spec/currency_spec.rb +11 -9
- data/spec/spec_helper.rb +0 -8
- metadata +70 -68
- data/VERSION +0 -1
data/.gitignore
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
-
*.
|
2
|
-
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
3
9
|
coverage
|
4
|
-
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
5
12
|
pkg
|
6
|
-
|
7
|
-
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm ruby@currencies
|
1
|
+
rvm use ruby-1.9.3@currencies --create
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,20 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
currencies (0.4.1)
|
5
|
+
|
1
6
|
GEM
|
2
|
-
remote:
|
7
|
+
remote: https://rubygems.org/
|
3
8
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
rspec (
|
12
|
-
|
13
|
-
|
9
|
+
diff-lcs (1.1.3)
|
10
|
+
rake (0.9.2.2)
|
11
|
+
rspec (2.10.0)
|
12
|
+
rspec-core (~> 2.10.0)
|
13
|
+
rspec-expectations (~> 2.10.0)
|
14
|
+
rspec-mocks (~> 2.10.0)
|
15
|
+
rspec-core (2.10.0)
|
16
|
+
rspec-expectations (2.10.0)
|
17
|
+
diff-lcs (~> 1.1.3)
|
18
|
+
rspec-mocks (2.10.1)
|
19
|
+
yard (0.8.1)
|
14
20
|
|
15
21
|
PLATFORMS
|
16
22
|
ruby
|
17
23
|
|
18
24
|
DEPENDENCIES
|
19
|
-
|
20
|
-
|
25
|
+
currencies!
|
26
|
+
rake
|
27
|
+
rspec
|
28
|
+
yard
|
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -65,7 +65,7 @@ Defaults
|
|
65
65
|
|
66
66
|
You can set the base currency by using the *base_currency* class method. This defaults to 'USD'.
|
67
67
|
|
68
|
-
ISO4217::Currency.base_currency
|
68
|
+
ISO4217::Currency.base_currency = 'GBP'
|
69
69
|
|
70
70
|
The exchange rate is either set manually or if nil looked up on Yahoo Finance and cached. If you want to disable looking up the currency set the *import_exchange_rates* class method to false.
|
71
71
|
|
data/Rakefile
CHANGED
@@ -1,43 +1,12 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "currencies"
|
8
|
-
gem.summary = %Q{Simple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.}
|
9
|
-
gem.description = %Q{If you are tracking any kind of assets the currencies gem is for you. It contains every currency in the ISO 4217 standard and allows you to add your own as well. So if you decide to take sparkly buttons as a form of payment you can use currencies to display the shiny button unicode symbol ☼ (disclaimer: ☼ may not look like a shiny button to everyone.) when used with something like the money gem. Speaking of the money gem, currencies gives you an ExchangeBank that the money gem can use to convert from one currency to another. There are plans to have ExchangeRate provider plugin system. Right now the rates are either set manually or pulled from Yahoo Finance.}
|
10
|
-
gem.email = "hexorx@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/hexorx/currencies"
|
12
|
-
gem.authors = ["hexorx"]
|
13
|
-
gem.add_development_dependency "rspec"
|
14
|
-
gem.add_development_dependency "yard"
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
Jeweler::GemcutterTasks.new
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
20
|
-
end
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
21
3
|
|
22
|
-
require '
|
23
|
-
|
24
|
-
spec.libs << 'lib' << 'spec'
|
25
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
-
end
|
4
|
+
require 'rake'
|
5
|
+
require 'rspec/core/rake_task'
|
27
6
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
spec.rcov = true
|
7
|
+
desc "Run all examples"
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.rspec_opts = %w[--color]
|
32
10
|
end
|
33
11
|
|
34
|
-
task :default => :spec
|
35
|
-
|
36
|
-
begin
|
37
|
-
require 'yard'
|
38
|
-
YARD::Rake::YardocTask.new
|
39
|
-
rescue LoadError
|
40
|
-
task :yardoc do
|
41
|
-
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
42
|
-
end
|
43
|
-
end
|
12
|
+
task :default => [:spec]
|
data/currencies.gemspec
CHANGED
@@ -1,67 +1,20 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/currencies/version', __FILE__)
|
5
3
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["hexorx", "pr0d1r2"]
|
6
|
+
gem.email = ["hexorx@gmail.com", "pr0d1r2@gmail.com"]
|
7
|
+
gem.description = %q{If you are tracking any kind of assets the currencies gem is for you. It contains every currency in the ISO 4217 standard and allows you to add your own as well. So if you decide to take sparkly buttons as a form of payment you can use currencies to display the shiny button unicode symbol ☼ (disclaimer: ☼ may not look like a shiny button to everyone.) when used with something like the money gem. Speaking of the money gem, currencies gives you an ExchangeBank that the money gem can use to convert from one currency to another. There are plans to have ExchangeRate provider plugin system. Right now the rates are either set manually or pulled from Yahoo Finance.}
|
8
|
+
gem.summary = %q{Simple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.}
|
9
|
+
gem.homepage = "http://github.com/hexorx/currencies"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
"LICENSE",
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
".rvmrc",
|
23
|
-
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
|
-
"LICENSE",
|
26
|
-
"README.markdown",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"currencies.gemspec",
|
30
|
-
"lib/currencies.rb",
|
31
|
-
"lib/currencies/currency.rb",
|
32
|
-
"lib/currencies/exchange_bank.rb",
|
33
|
-
"lib/currencies/extentions.rb",
|
34
|
-
"lib/data/iso4217.yaml",
|
35
|
-
"lib/iso4217.rb",
|
36
|
-
"spec/currency_spec.rb",
|
37
|
-
"spec/exchange_bank_spec.rb",
|
38
|
-
"spec/spec_helper.rb"
|
39
|
-
]
|
40
|
-
s.homepage = %q{http://github.com/hexorx/currencies}
|
41
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
-
s.require_paths = ["lib"]
|
43
|
-
s.rubygems_version = %q{1.3.7}
|
44
|
-
s.summary = %q{Simple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.}
|
45
|
-
s.test_files = [
|
46
|
-
"spec/currency_spec.rb",
|
47
|
-
"spec/exchange_bank_spec.rb",
|
48
|
-
"spec/spec_helper.rb"
|
49
|
-
]
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "currencies"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Currencies::VERSION
|
50
17
|
|
51
|
-
|
52
|
-
|
53
|
-
s.specification_version = 3
|
54
|
-
|
55
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
58
|
-
else
|
59
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
60
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
61
|
-
end
|
62
|
-
else
|
63
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
64
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
65
|
-
end
|
18
|
+
gem.add_development_dependency "rspec"
|
19
|
+
gem.add_development_dependency "yard"
|
66
20
|
end
|
67
|
-
|
data/lib/currencies.rb
CHANGED
data/spec/currency_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
4
|
|
3
5
|
describe ISO4217::Currency do
|
@@ -5,7 +7,7 @@ describe ISO4217::Currency do
|
|
5
7
|
@usd = ISO4217::Currency.from_code(:USD)
|
6
8
|
@gbp = ISO4217::Currency.from_code(:GBP)
|
7
9
|
end
|
8
|
-
|
10
|
+
|
9
11
|
it 'should return code' do
|
10
12
|
@usd.code.should == 'USD'
|
11
13
|
@gbp.code.should == 'GBP'
|
@@ -14,7 +16,7 @@ describe ISO4217::Currency do
|
|
14
16
|
@usd['code'].should == 'USD'
|
15
17
|
@gbp['code'].should == 'GBP'
|
16
18
|
end
|
17
|
-
|
19
|
+
|
18
20
|
it 'should return symbol' do
|
19
21
|
@usd.symbol.should == '$'
|
20
22
|
@gbp.symbol.should == '£'
|
@@ -23,7 +25,7 @@ describe ISO4217::Currency do
|
|
23
25
|
@usd['symbol'].should == '$'
|
24
26
|
@gbp['symbol'].should == '£'
|
25
27
|
end
|
26
|
-
|
28
|
+
|
27
29
|
it 'should return name' do
|
28
30
|
@usd.name.should == 'Dollars'
|
29
31
|
@gbp.name.should == 'Pounds'
|
@@ -32,33 +34,33 @@ describe ISO4217::Currency do
|
|
32
34
|
@usd['name'].should == 'Dollars'
|
33
35
|
@gbp['name'].should == 'Pounds'
|
34
36
|
end
|
35
|
-
|
37
|
+
|
36
38
|
describe 'from_code' do
|
37
39
|
it 'should return new Currency instance when passed iso4217 currency code' do
|
38
40
|
ISO4217::Currency.from_code('USD').should be_a(ISO4217::Currency)
|
39
41
|
end
|
40
|
-
|
42
|
+
|
41
43
|
it 'should return a currency with the same code' do
|
42
44
|
ISO4217::Currency.from_code('USD').code.should == 'USD'
|
43
45
|
ISO4217::Currency.from_code('GBP').code.should == 'GBP'
|
44
46
|
end
|
45
|
-
|
47
|
+
|
46
48
|
it 'should accept symbol' do
|
47
49
|
ISO4217::Currency.from_code(:USD).code.should == 'USD'
|
48
50
|
ISO4217::Currency.from_code(:GBP).code.should == 'GBP'
|
49
51
|
end
|
50
|
-
|
52
|
+
|
51
53
|
it 'should work with lower case' do
|
52
54
|
ISO4217::Currency.from_code('usd').code.should == 'USD'
|
53
55
|
ISO4217::Currency.from_code('gbp').code.should == 'GBP'
|
54
56
|
end
|
55
57
|
end
|
56
|
-
|
58
|
+
|
57
59
|
describe 'exchange_rate' do
|
58
60
|
it 'should return a float' do
|
59
61
|
ISO4217::Currency.from_code('GBP').exchange_rate.should be_a(Float)
|
60
62
|
end
|
61
|
-
|
63
|
+
|
62
64
|
it 'should have an exchange rate of 1.0 for the base currency' do
|
63
65
|
ISO4217::Currency.from_code(ISO4217::Currency.base_currency).exchange_rate.should == 1.0
|
64
66
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,61 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: currencies
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 0
|
10
|
-
version: 0.4.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.1
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- hexorx
|
9
|
+
- pr0d1r2
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2013-05-11 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: rspec
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
33
23
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: yard
|
37
24
|
prerelease: false
|
38
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: yard
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
39
34
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
47
39
|
type: :development
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
description: ! 'If you are tracking any kind of assets the currencies gem is for you.
|
48
|
+
It contains every currency in the ISO 4217 standard and allows you to add your own
|
49
|
+
as well. So if you decide to take sparkly buttons as a form of payment you can use
|
50
|
+
currencies to display the shiny button unicode symbol ☼ (disclaimer: ☼ may not look
|
51
|
+
like a shiny button to everyone.) when used with something like the money gem. Speaking
|
52
|
+
of the money gem, currencies gives you an ExchangeBank that the money gem can use
|
53
|
+
to convert from one currency to another. There are plans to have ExchangeRate provider
|
54
|
+
plugin system. Right now the rates are either set manually or pulled from Yahoo
|
55
|
+
Finance.'
|
56
|
+
email:
|
57
|
+
- hexorx@gmail.com
|
58
|
+
- pr0d1r2@gmail.com
|
51
59
|
executables: []
|
52
|
-
|
53
60
|
extensions: []
|
54
|
-
|
55
|
-
|
56
|
-
- LICENSE
|
57
|
-
- README.markdown
|
58
|
-
files:
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
59
63
|
- .document
|
60
64
|
- .gitignore
|
61
65
|
- .rvmrc
|
@@ -64,52 +68,50 @@ files:
|
|
64
68
|
- LICENSE
|
65
69
|
- README.markdown
|
66
70
|
- Rakefile
|
67
|
-
- VERSION
|
68
71
|
- currencies.gemspec
|
69
72
|
- lib/currencies.rb
|
70
73
|
- lib/currencies/currency.rb
|
71
74
|
- lib/currencies/exchange_bank.rb
|
72
75
|
- lib/currencies/extentions.rb
|
76
|
+
- lib/currencies/version.rb
|
73
77
|
- lib/data/iso4217.yaml
|
74
78
|
- lib/iso4217.rb
|
75
79
|
- spec/currency_spec.rb
|
76
80
|
- spec/exchange_bank_spec.rb
|
77
81
|
- spec/spec_helper.rb
|
78
|
-
has_rdoc: true
|
79
82
|
homepage: http://github.com/hexorx/currencies
|
80
83
|
licenses: []
|
81
|
-
|
82
84
|
post_install_message:
|
83
|
-
rdoc_options:
|
84
|
-
|
85
|
-
require_paths:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
86
87
|
- lib
|
87
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
89
|
none: false
|
89
|
-
requirements:
|
90
|
-
- -
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
segments:
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
segments:
|
94
95
|
- 0
|
95
|
-
|
96
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
hash: -3014364688897172461
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
98
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
segments:
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
segments:
|
103
104
|
- 0
|
104
|
-
|
105
|
+
hash: -3014364688897172461
|
105
106
|
requirements: []
|
106
|
-
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 1.8.23
|
109
109
|
signing_key:
|
110
110
|
specification_version: 3
|
111
|
-
summary: Simple gem for working with currencies. It is extracted from the countries
|
112
|
-
|
111
|
+
summary: Simple gem for working with currencies. It is extracted from the countries
|
112
|
+
gem and contains all the currency information in the ISO 4217 standard.
|
113
|
+
test_files:
|
113
114
|
- spec/currency_spec.rb
|
114
115
|
- spec/exchange_bank_spec.rb
|
115
116
|
- spec/spec_helper.rb
|
117
|
+
has_rdoc:
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.0
|