gyomu_ruby 0.0.4 → 0.0.5

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.
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Version 0.0.5
2
+
3
+ * rename Integer#ceil(offset), Integer#floor(offset) to Numeric#roundup(offset), Numeric#rounddown(offset)
4
+
1
5
  # Version 0.0.4
2
6
 
3
7
  * added Integer#ceil(offset), Integer#floor(offset)
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
2
  require 'gyomu_ruby/core_ext/time'
3
+ require 'gyomu_ruby/core_ext/numeric'
3
4
  require 'gyomu_ruby/amazon_web_service/file_bucket'
4
5
  require 'gyomu_ruby/ordinary_system_development'
@@ -0,0 +1,6 @@
1
+ # coding: utf-8
2
+ require 'gyomu_ruby/core_ext/numeric/round'
3
+
4
+ Numeric.class_eval do
5
+ include GyomuRuby::CoreExt::Numeric::Round
6
+ end
@@ -0,0 +1,15 @@
1
+ module GyomuRuby
2
+ module CoreExt
3
+ module Numeric
4
+ module Round
5
+ def roundup(offset)
6
+ ((self + offset) * Rational(1, offset)).ceil * offset - offset
7
+ end
8
+
9
+ def rounddown(offset)
10
+ (self * Rational(1, offset)).floor * offset
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,4 +1,4 @@
1
- #coding: utf-8
1
+ # coding: utf-8
2
2
  require 'gyomu_ruby/core_ext/time/biz_year'
3
3
 
4
4
  Time.class_eval do
@@ -1,4 +1,4 @@
1
- #coding: utf-8
1
+ # coding: utf-8
2
2
  module GyomuRuby
3
3
  module CoreExt
4
4
  module Time
@@ -1,3 +1,3 @@
1
1
  module GyomuRuby
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+ require 'gyomu_ruby/core_ext/numeric'
3
+
4
+ describe Numeric, 'gyomu_ruby extentions' do
5
+ describe '#roundup' do
6
+ it { 101.roundup(50).should == 150 }
7
+ it { 151.roundup(50).should == 200 }
8
+ it { 123.roundup(3).should == 123 }
9
+ it { 10.1.roundup(2).should == 12 }
10
+ end
11
+
12
+ describe '#rounddown' do
13
+ it { 101.rounddown(50).should == 100 }
14
+ it { 151.rounddown(50).should == 150 }
15
+ it { 123.rounddown(3).should == 123 }
16
+ it { 10.1.rounddown(2).should == 10 }
17
+ end
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gyomu_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-08 00:00:00.000000000 Z
12
+ date: 2012-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70139244869760 !ruby/object:Gem::Requirement
16
+ requirement: &70316203047040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70139244869760
24
+ version_requirements: *70316203047040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: aws-s3
27
- requirement: &70139244867040 !ruby/object:Gem::Requirement
27
+ requirement: &70316203044320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70139244867040
35
+ version_requirements: *70316203044320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70139241111060 !ruby/object:Gem::Requirement
38
+ requirement: &70316203032080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70139241111060
46
+ version_requirements: *70316203032080
47
47
  description: GyomuRuby
48
48
  email:
49
49
  - rubyagile@qwik.tky.esm.co.jp
@@ -59,8 +59,8 @@ files:
59
59
  - gyomu_ruby.gemspec
60
60
  - lib/gyomu_ruby.rb
61
61
  - lib/gyomu_ruby/amazon_web_service/file_bucket.rb
62
- - lib/gyomu_ruby/core_ext/integer.rb
63
- - lib/gyomu_ruby/core_ext/integer/round.rb
62
+ - lib/gyomu_ruby/core_ext/numeric.rb
63
+ - lib/gyomu_ruby/core_ext/numeric/round.rb
64
64
  - lib/gyomu_ruby/core_ext/time.rb
65
65
  - lib/gyomu_ruby/core_ext/time/biz_year.rb
66
66
  - lib/gyomu_ruby/forgery/dictionaries/ja_female_first_names
@@ -74,7 +74,7 @@ files:
74
74
  - lib/gyomu_ruby/version.rb
75
75
  - masters/ext_tel_numbers.csv
76
76
  - masters/prefectures.csv
77
- - spec/core_ext/integer_spec.rb
77
+ - spec/core_ext/numeric_spec.rb
78
78
  - spec/core_ext/time_spec.rb
79
79
  - spec/spec_helper.rb
80
80
  homepage: http://www.esm.co.jp/
@@ -102,7 +102,7 @@ signing_key:
102
102
  specification_version: 3
103
103
  summary: GyomuRuby
104
104
  test_files:
105
- - spec/core_ext/integer_spec.rb
105
+ - spec/core_ext/numeric_spec.rb
106
106
  - spec/core_ext/time_spec.rb
107
107
  - spec/spec_helper.rb
108
108
  has_rdoc:
@@ -1 +0,0 @@
1
- require 'gyomu_ruby/core_ext/integer/round'
@@ -1,9 +0,0 @@
1
- class Integer
2
- def ceil(offset)
3
- ((self + offset) * Rational(1, offset)).ceil * offset - offset
4
- end
5
-
6
- def floor(offset)
7
- (self * Rational(1, offset)).floor * offset
8
- end
9
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
- require 'gyomu_ruby/core_ext/integer'
3
-
4
- describe Integer, 'gyomu_ruby extentions' do
5
- describe '#ceil' do
6
- it { 101.ceil(50).should == 150 }
7
- it { 151.ceil(50).should == 200 }
8
- it { 121.ceil(3).should == 123 }
9
- it { 123.ceil(3).should == 123 }
10
- end
11
-
12
- describe '#floor' do
13
- it { 101.floor(50).should == 100 }
14
- it { 151.floor(50).should == 150 }
15
- it { 121.floor(3).should == 120 }
16
- it { 123.floor(3).should == 123 }
17
- end
18
- end