better-money 0.0.1 → 0.0.2
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.
- checksums.yaml +8 -8
- data/.rspec +2 -0
- data/CHANGELOG +3 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +51 -0
- data/Guardfile +9 -0
- data/better-money-0.0.2.gem +0 -0
- data/better_money.gemspec +20 -0
- data/lib/better_money/version.rb +1 -1
- data/spec/lib/better_money/analyzer_spec.rb +63 -0
- data/spec/lib/better_money_spec.rb +14 -0
- data/spec/spec_helper.rb +17 -0
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWM2MDVjZDFiYmU1MWFlN2E4YmZmYjlkYzQ0ZGQ5MGZiMTI0MDIwYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODNkMmFiOTg0NzVkYWI2NGUxMDY2ZjFkMTIzNjZjMjRhMmRiOGYyYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTZkNWI4M2E5NGZhZWUzMTA4MTkxMzY2NjFhNDY0ZDM5NmVlM2Q2MjYzMmNh
|
10
|
+
OTkzMjc3YmNjZGU5MDBmZmZjNzcxMmQ2MzFjMWQ2NzBiMjk0YTdiZjYyNzk3
|
11
|
+
YWUwYzY1N2RjZDFkODg0ZjhhMGI3ZjU4OThjNzg2MTZkYTM5M2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzRjZTFkYWIwZWJkNmVlZTIxOWI2YmQxZjIyZjUwNDJmNWJjNTNlZGU0ZDY4
|
14
|
+
MTQ4YzhjYjRlMmMyOWZiMzY4ZWI2ZjgzZGNiYzExMTI4NmQxMTRjOWZlNjM5
|
15
|
+
OTdkOGVmODk5NzU1ZGZjMDY4YTk0MmIzMDUyYmRjYjBkYWFmYmY=
|
data/.rspec
ADDED
data/CHANGELOG
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://www.rubygems.org/
|
3
|
+
specs:
|
4
|
+
celluloid (0.15.2)
|
5
|
+
timers (~> 1.1.0)
|
6
|
+
coderay (1.1.0)
|
7
|
+
diff-lcs (1.2.5)
|
8
|
+
ffi (1.9.3)
|
9
|
+
formatador (0.2.4)
|
10
|
+
guard (2.2.4)
|
11
|
+
formatador (>= 0.2.4)
|
12
|
+
listen (~> 2.1)
|
13
|
+
lumberjack (~> 1.0)
|
14
|
+
pry (>= 0.9.12)
|
15
|
+
thor (>= 0.18.1)
|
16
|
+
guard-rspec (4.2.0)
|
17
|
+
guard (>= 2.1.1)
|
18
|
+
rspec (>= 2.14, < 4.0)
|
19
|
+
listen (2.4.0)
|
20
|
+
celluloid (>= 0.15.2)
|
21
|
+
rb-fsevent (>= 0.9.3)
|
22
|
+
rb-inotify (>= 0.9)
|
23
|
+
lumberjack (1.0.4)
|
24
|
+
method_source (0.8.2)
|
25
|
+
pry (0.9.12.4)
|
26
|
+
coderay (~> 1.0)
|
27
|
+
method_source (~> 0.8)
|
28
|
+
slop (~> 3.4)
|
29
|
+
rake (10.1.0)
|
30
|
+
rb-fsevent (0.9.3)
|
31
|
+
rb-inotify (0.9.2)
|
32
|
+
ffi (>= 0.5.0)
|
33
|
+
rspec (2.14.1)
|
34
|
+
rspec-core (~> 2.14.0)
|
35
|
+
rspec-expectations (~> 2.14.0)
|
36
|
+
rspec-mocks (~> 2.14.0)
|
37
|
+
rspec-core (2.14.7)
|
38
|
+
rspec-expectations (2.14.4)
|
39
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
40
|
+
rspec-mocks (2.14.4)
|
41
|
+
slop (3.4.7)
|
42
|
+
thor (0.18.1)
|
43
|
+
timers (1.1.0)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
guard-rspec
|
50
|
+
rake
|
51
|
+
rspec
|
data/Guardfile
ADDED
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "./lib/better_money/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'better-money'
|
6
|
+
s.version = BetterMoney::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.date = Date.today
|
9
|
+
s.summary = "Better money displanation"
|
10
|
+
s.description = "Better money displanation"
|
11
|
+
s.authors = ["Sung-Hee Kang"]
|
12
|
+
s.email = 'sungheee.kang@gmail.com'
|
13
|
+
s.rubyforge_project = "better-money"
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.homepage = 'http://github.com/sungheekang/better-money'
|
19
|
+
s.license = 'MIT'
|
20
|
+
end
|
data/lib/better_money/version.rb
CHANGED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/better_money/analyzer'
|
3
|
+
|
4
|
+
|
5
|
+
describe BetterMoney::Analyzer do
|
6
|
+
describe "#currency_symbol" do
|
7
|
+
it "should find symbol of current currency" do
|
8
|
+
analyzer = BetterMoney::Analyzer.new(9999)
|
9
|
+
analyzer.currency_symbol.should == "$"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#value" do
|
14
|
+
it "should find value of current currency" do
|
15
|
+
analyzer = BetterMoney::Analyzer.new(123)
|
16
|
+
analyzer.value.should == 123.00
|
17
|
+
|
18
|
+
analyzer = BetterMoney::Analyzer.new(12345)
|
19
|
+
analyzer.value.should == 12.35
|
20
|
+
|
21
|
+
analyzer = BetterMoney::Analyzer.new(12345678)
|
22
|
+
analyzer.value.should == 12.35
|
23
|
+
|
24
|
+
analyzer = BetterMoney::Analyzer.new(1234567890)
|
25
|
+
analyzer.value.should == 1.23
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#unit_symbol" do
|
30
|
+
it "should find unit of current currency" do
|
31
|
+
analyzer = BetterMoney::Analyzer.new(123)
|
32
|
+
analyzer.unit_symbol.should == ""
|
33
|
+
|
34
|
+
analyzer = BetterMoney::Analyzer.new(12345)
|
35
|
+
analyzer.unit_symbol.should == "k"
|
36
|
+
|
37
|
+
analyzer = BetterMoney::Analyzer.new(12345678)
|
38
|
+
analyzer.unit_symbol.should == "M"
|
39
|
+
|
40
|
+
analyzer = BetterMoney::Analyzer.new(1234567890)
|
41
|
+
analyzer.unit_symbol.should == "B"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "#seperate_level" do
|
46
|
+
it "should find seperate level" do
|
47
|
+
analyzer = BetterMoney::Analyzer.new(123)
|
48
|
+
analyzer.seperate_level.should == 0
|
49
|
+
|
50
|
+
analyzer = BetterMoney::Analyzer.new(12345)
|
51
|
+
analyzer.seperate_level.should == 1
|
52
|
+
|
53
|
+
analyzer = BetterMoney::Analyzer.new(12345678)
|
54
|
+
analyzer.seperate_level.should == 2
|
55
|
+
|
56
|
+
analyzer = BetterMoney::Analyzer.new(1234567890)
|
57
|
+
analyzer.seperate_level.should == 3
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/better_money'
|
3
|
+
|
4
|
+
|
5
|
+
describe "better-money" do
|
6
|
+
it "should tidy amount of dollar" do
|
7
|
+
better_money(123.45).should == "$123.45"
|
8
|
+
better_money(1234.56).should == "$1.23k"
|
9
|
+
better_money(12345678).should == "$12.35M"
|
10
|
+
better_money(1234567890).should == "$1.23B"
|
11
|
+
better_money(12345678901234).should == "$12.35T"
|
12
|
+
better_money(1234567890123456).should == "$1234.57T"
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better-money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sung-Hee Kang
|
@@ -16,9 +16,19 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- .rspec
|
20
|
+
- CHANGELOG
|
21
|
+
- Gemfile
|
22
|
+
- Gemfile.lock
|
23
|
+
- Guardfile
|
24
|
+
- better-money-0.0.2.gem
|
25
|
+
- better_money.gemspec
|
19
26
|
- lib/better_money.rb
|
20
|
-
- lib/better_money/version.rb
|
21
27
|
- lib/better_money/analyzer.rb
|
28
|
+
- lib/better_money/version.rb
|
29
|
+
- spec/lib/better_money/analyzer_spec.rb
|
30
|
+
- spec/lib/better_money_spec.rb
|
31
|
+
- spec/spec_helper.rb
|
22
32
|
homepage: http://github.com/sungheekang/better-money
|
23
33
|
licenses:
|
24
34
|
- MIT
|
@@ -38,10 +48,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
48
|
- !ruby/object:Gem::Version
|
39
49
|
version: '0'
|
40
50
|
requirements: []
|
41
|
-
rubyforge_project:
|
51
|
+
rubyforge_project: better-money
|
42
52
|
rubygems_version: 2.0.3
|
43
53
|
signing_key:
|
44
54
|
specification_version: 4
|
45
55
|
summary: Better money displanation
|
46
|
-
test_files:
|
56
|
+
test_files:
|
57
|
+
- spec/lib/better_money/analyzer_spec.rb
|
58
|
+
- spec/lib/better_money_spec.rb
|
59
|
+
- spec/spec_helper.rb
|
47
60
|
has_rdoc:
|