date_discreter 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f535be8df5bbbf5faea7894c3b2eea4f1050a39a
4
+ data.tar.gz: 365e388a011e14bc50f2c35dfad8f3f19f3cbb72
5
+ SHA512:
6
+ metadata.gz: 6e7eaf9c54bab9a6293edbe01e97fcd6b1f5de6e98032045a249df4ada3a259168b2016e3f2366448ce8cc08a599ae13b4ce3e3adadfb1cf0528637e3433c3d0
7
+ data.tar.gz: 74866613c34da2ebf406d0da7b474c036fab991d594ac9b569bc7a651dd81b682aa1bbeaa098183c7cd2132016fb2ce2ac26ed9c350270e991c08ad24cc5baff
data/.tachikoma.yml ADDED
@@ -0,0 +1 @@
1
+ strategy: 'bundler'
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ rvm:
5
5
  - 2.1
6
6
  - 2.2
7
7
  - ruby-head
8
+ cache: bundler
8
9
  bundler_args: "--jobs=2"
9
10
  before_script:
10
11
  - export CODECLIMATE_REPO_TOKEN=ba1cb6377edbaa3baf183aad543a1db02e0f2b75fe676fa8b9db2294850af609
@@ -21,5 +22,5 @@ notifications:
21
22
  secure: dJhFmNRz7dtbnspVC0FYcdDhX/HAjTTbPRBa4GXtyDH5UUU9PqltcKfj2/ZG/28gktvO3Av1yoLP7sEAPNzkCSEjGMc5pT3hAeKub4WC/2OQ/eb19lBMupz3amJeZd7CWv6vHwYhyU2VFXpFa4AIn7WnR+XDHu7S3+ScQNJuz4E=
22
23
  matrix:
23
24
  allow_failures:
24
- - rvm: 2.2
25
25
  - rvm: ruby-head
26
+ sudo: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ ## master
2
+ [full changelog](https://github.com/sue445/date_discreter/compare/v0.0.2...master)
3
+
4
+ ## 0.0.2 (2015/11/17)
5
+ [full changelog](https://github.com/sue445/date_discreter/compare/v0.0.1...v0.0.2)
6
+
7
+ * Support for consecutive lacks
8
+ * https://github.com/sue445/date_discreter/pull/8
9
+
10
+ ## 0.0.1 (2014/11/30)
11
+ * first release
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in date_discreter.gemspec
4
4
  gemspec
5
-
6
- gem "rubydoctest", github: "tablatom/rubydoctest", group: [:development, :test]
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Check discrete of months, days and hours
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/date_discreter.svg)](http://badge.fury.io/rb/date_discreter)
5
6
  [![Build Status](https://travis-ci.org/sue445/date_discreter.svg?branch=master)](https://travis-ci.org/sue445/date_discreter)
6
7
  [![Dependency Status](https://gemnasium.com/sue445/date_discreter.svg)](https://gemnasium.com/sue445/date_discreter)
7
8
  [![Code Climate](https://codeclimate.com/github/sue445/date_discreter/badges/gpa.svg)](https://codeclimate.com/github/sue445/date_discreter)
@@ -25,5 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "coveralls"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "rspec"
28
+ spec.add_development_dependency "rubydoctest", ">= 1.1.5"
28
29
  spec.add_development_dependency "yard"
29
30
  end
@@ -26,11 +26,15 @@ module DateDiscreter
26
26
  end
27
27
 
28
28
  def discrete_times(target_times, degree)
29
- res = []
30
- target_times.sort.each_cons(2) do |this_time, next_time|
31
- res << this_time + degree unless this_time + degree == next_time
29
+ raise ArgumentError, "specify at least 2 elems" if target_times.length < 2
30
+ sorted = target_times.sort
31
+ cursor, range_upper = sorted[0], sorted[-1]
32
+ filledup = []
33
+ while (cursor < range_upper)
34
+ filledup << cursor
35
+ cursor += degree
32
36
  end
33
- res
37
+ filledup - target_times
34
38
  end
35
39
  private_class_method :discrete_times
36
40
 
@@ -1,3 +1,3 @@
1
1
  module DateDiscreter
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -56,6 +56,14 @@ describe DateDiscreter do
56
56
  ]
57
57
  end
58
58
 
59
+ let(:discrete_hours_2lacks) do
60
+ [
61
+ to_time("2013-10-01 00:00:00"),
62
+ to_time("2013-10-01 01:00:00"),
63
+ to_time("2013-10-01 04:00:00"),
64
+ ]
65
+ end
66
+
59
67
  describe "#discrete_months" do
60
68
  subject{ DateDiscreter.discrete_months(months) }
61
69
 
@@ -134,6 +142,12 @@ describe DateDiscreter do
134
142
 
135
143
  it{ should eq [to_time("2013-10-01 03:00:00")] }
136
144
  end
145
+
146
+ context "consecutive lacks" do
147
+ let(:hours){ discrete_hours_2lacks }
148
+
149
+ it{ should eq [to_time("2013-10-01 02:00:00"), to_time("2013-10-01 03:00:00")] }
150
+ end
137
151
  end
138
152
 
139
153
  describe "#continuous_months?" do
metadata CHANGED
@@ -1,126 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date_discreter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - sue445
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-11-30 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '1.5'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '1.5'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: codeclimate-test-reporter
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: coveralls
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '10.0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '10.0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubydoctest
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.1.5
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.1.5
110
111
  - !ruby/object:Gem::Dependency
111
112
  name: yard
112
113
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
114
  requirements:
115
- - - ! '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
121
  requirements:
123
- - - ! '>='
122
+ - - ">="
124
123
  - !ruby/object:Gem::Version
125
124
  version: '0'
126
125
  description: Check discrete of months, days and hours
@@ -130,12 +129,14 @@ executables: []
130
129
  extensions: []
131
130
  extra_rdoc_files: []
132
131
  files:
133
- - .coveralls.yml
134
- - .gitignore
135
- - .hound.yml
136
- - .rspec
137
- - .travis.yml
138
- - .yardopts
132
+ - ".coveralls.yml"
133
+ - ".gitignore"
134
+ - ".hound.yml"
135
+ - ".rspec"
136
+ - ".tachikoma.yml"
137
+ - ".travis.yml"
138
+ - ".yardopts"
139
+ - CHANGELOG.md
139
140
  - Gemfile
140
141
  - LICENSE.txt
141
142
  - README.md
@@ -148,33 +149,26 @@ files:
148
149
  homepage: https://github.com/sue445/date_discreter
149
150
  licenses:
150
151
  - MIT
152
+ metadata: {}
151
153
  post_install_message:
152
154
  rdoc_options: []
153
155
  require_paths:
154
156
  - lib
155
157
  required_ruby_version: !ruby/object:Gem::Requirement
156
- none: false
157
158
  requirements:
158
- - - ! '>='
159
+ - - ">="
159
160
  - !ruby/object:Gem::Version
160
161
  version: '0'
161
- segments:
162
- - 0
163
- hash: 2815363592125099921
164
162
  required_rubygems_version: !ruby/object:Gem::Requirement
165
- none: false
166
163
  requirements:
167
- - - ! '>='
164
+ - - ">="
168
165
  - !ruby/object:Gem::Version
169
166
  version: '0'
170
- segments:
171
- - 0
172
- hash: 2815363592125099921
173
167
  requirements: []
174
168
  rubyforge_project:
175
- rubygems_version: 1.8.23.2
169
+ rubygems_version: 2.4.5.1
176
170
  signing_key:
177
- specification_version: 3
171
+ specification_version: 4
178
172
  summary: Check discrete of months, days and hours
179
173
  test_files:
180
174
  - spec/date_discreter_spec.rb