yen 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c532519de0cb50f44b3946aadcefa3c7b2ac494
4
- data.tar.gz: 73e83810792582b507bcd333a1b2461aa671f3e9
3
+ metadata.gz: 78d04fd02cb2a41818abd19659809df4cb282c02
4
+ data.tar.gz: 6cd084755859e69c511e6641ce33fd31e0efcf34
5
5
  SHA512:
6
- metadata.gz: 3f6dc09b231be4d7d839946f45d8d7bf035b28837c0b96c73163119c89695ca4ac3019eeb65cce04a77fcc75b33fb9ff598075217108f42611aa557fbcf54d58
7
- data.tar.gz: 61fd5210f80fe2e0cc6cc23effe8ac1cff22dc375c4166cfaadb84fd76d9d576de376dbbb74b4a9146cee760efd5665e97e36de54455d2fdd0f6843c75587763
6
+ metadata.gz: f8141d47a24e1bb41a49d09ae2776ebae3fcfc12cba40c55de129208bd60a58f1972cd01a602b1b3ea5ba9c4861b90f856b78959939455996479ce7af057d6b5
7
+ data.tar.gz: cfc84c55cdb5a28e75b9116ac33c266375218906f0dbaebd7e6cc08373ade29fda1106aa9d8571428c11e784b3123e8128d9726da82e00c22fbdcec53abd3bf8
data/.gitignore CHANGED
@@ -15,6 +15,7 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
18
19
 
19
20
  **/*.swp
20
21
  *.swp
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/lib/yen.rb CHANGED
@@ -1,6 +1,16 @@
1
1
  # encoding: utf-8
2
2
  require "yen/version"
3
3
 
4
+ class NilClass
5
+ def to_yen(type = :positional)
6
+ 0.to_yen(type)
7
+ end
8
+
9
+ def to_j(type = :positional)
10
+ 0.to_j(type)
11
+ end
12
+ end
13
+
4
14
  class Integer
5
15
  def to_yen(type = :positional)
6
16
  self.to_j(type) + "円"
@@ -1,3 +1,3 @@
1
1
  module Yen
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,9 +1,12 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
  require 'yen'
3
5
 
4
6
  describe "Test for to_j method" do
5
7
  describe "to_j :all option" do
6
8
  it "between 0 - 1万" do
9
+ expect(0.to_j(:all)).to eq("零")
7
10
  expect(0.to_j(:all)).to eq("零")
8
11
  expect(1.to_j(:all)).to eq("一")
9
12
  expect(2.to_j(:all)).to eq("二")
@@ -106,20 +109,21 @@ describe "Test for to_j method" do
106
109
  end
107
110
 
108
111
  it "between 1兆 - 1垓" do
109
- 1000000000000.to_j(:all).should == "一兆"
110
- 1000000000001.to_j(:all).should == "一兆一"
111
- 1000100010001.to_j(:all).should == "一兆一億一万一"
112
- 2000000000000.to_j(:all).should == "二兆"
113
- 10000000000000000.to_j(:all).should == "一京"
114
- 10000000000000001.to_j(:all).should == "一京一"
115
- 10001000000000001.to_j(:all).should == "一京一兆一"
116
- 12345678912345678.to_j(:all).should == "一京二千三百四十五兆六千七百八十九億一千二百三十四万五千六百七十八"
117
- 100000000000000000000.to_j(:all).should == "一垓"
112
+ expect(1000000000000.to_j(:all)).to eq("一兆")
113
+ expect(1000000000001.to_j(:all)).to eq("一兆一")
114
+ expect(1000100010001.to_j(:all)).to eq("一兆一億一万一")
115
+ expect(2000000000000.to_j(:all)).to eq("二兆")
116
+ expect(10000000000000000.to_j(:all)).to eq("一京")
117
+ expect(10000000000000001.to_j(:all)).to eq("一京一")
118
+ expect(10001000000000001.to_j(:all)).to eq("一京一兆一")
119
+ expect(12345678912345678.to_j(:all)).to eq("一京二千三百四十五兆六千七百八十九億一千二百三十四万五千六百七十八")
120
+ expect(100000000000000000000.to_j(:all)).to eq("一垓")
118
121
  end
119
122
  end
120
123
 
121
124
  describe "test to_j positional option" do
122
125
  it "between 0 - 9999" do
126
+ expect(nil.to_j).to eq("0")
123
127
  expect(0.to_j).to eq("0")
124
128
  expect(1.to_j).to eq("1")
125
129
  expect(2.to_j).to eq("2")
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Yen::VERSION
9
9
  spec.authors = ["siman-man"]
10
10
  spec.email = ["k128585@ie.u-ryukyu.ac.jp"]
11
- spec.description = "this is convert integer to yen."
11
+ spec.description = "this is convert integer to yen"
12
12
  spec.summary = "this is convert integer to yen."
13
13
  spec.homepage = "https://github.com/siman-man/yen"
14
14
  spec.license = "MIT"
metadata CHANGED
@@ -1,65 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - siman-man
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-21 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: this is convert integer to yen.
55
+ description: this is convert integer to yen
56
56
  email:
57
57
  - k128585@ie.u-ryukyu.ac.jp
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
@@ -80,17 +80,17 @@ require_paths:
80
80
  - lib
81
81
  required_ruby_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.0.3
93
+ rubygems_version: 2.4.5
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: this is convert integer to yen.