increments-schedule 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.rubocop.yml +16 -0
- data/.travis.yml +5 -0
- data/Gemfile +11 -1
- data/README.md +8 -4
- data/Rakefile +10 -1
- data/bin/console +4 -7
- data/bin/setup +0 -0
- data/increments-schedule.gemspec +9 -11
- data/lib/increments/schedule.rb +19 -14
- data/lib/increments/schedule/version.rb +1 -1
- metadata +11 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fe27edbd3d6bb9e8321a6ae62acb19e31fc75d2
|
4
|
+
data.tar.gz: d4ac0b3633b9f485d2af3246e5d558d3f8639871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bc42c8b190cacd4a9829e71a494aeea0aa7264a8ddb75e6a4db7cd1de5c488879551bc1485611c2b813cd5ab617b27e7b6ec4541eeba08ae73497ea3a6fac5a
|
7
|
+
data.tar.gz: 803f794edd1d5fddcc116dba974b601772215e3342678b2f68505380a7d5cea812464789a85f62687bffb1d29775146bef7c637effb1e71a2809becaec4b5f8b
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,14 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in increments-schedule.gemspec
|
4
3
|
gemspec
|
4
|
+
|
5
|
+
group :development, :test do
|
6
|
+
gem 'rake', '~> 10.0'
|
7
|
+
gem 'rspec', '~> 3.2'
|
8
|
+
gem 'rubocop', '~> 0.30'
|
9
|
+
gem 'timecop', '~> 0.7'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem 'pry', '~> 0.10'
|
14
|
+
end
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
[![Gem Version](http://img.shields.io/gem/v/increments-schedule.svg?style=flat)](http://badge.fury.io/rb/increments-schedule)
|
2
|
+
[![Dependency Status](http://img.shields.io/gemnasium/increments/increments-schedule.svg?style=flat)](https://gemnasium.com/increments/increments-schedule)
|
3
|
+
[![Build Status](https://travis-ci.org/increments/increments-schedule.svg?branch=master&style=flat)](https://travis-ci.org/increments/increments-schedule)
|
2
4
|
|
3
|
-
|
5
|
+
# Increments::Schedule
|
4
6
|
|
5
|
-
|
7
|
+
Find out our special remote days and eagerly wait them!
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
@@ -22,7 +24,9 @@ Or install it yourself as:
|
|
22
24
|
|
23
25
|
## Usage
|
24
26
|
|
25
|
-
|
27
|
+
* `Increments::Schedule.each_remote_work_day`
|
28
|
+
* `Increments::Schedule.each_normal_remote_work_day`
|
29
|
+
* `Increments::Schedule.each_special_remote_work_day`
|
26
30
|
|
27
31
|
## Development
|
28
32
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'increments/schedule'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
10
|
+
require 'pry'
|
11
|
+
Pry.start
|
data/bin/setup
CHANGED
File without changes
|
data/increments-schedule.gemspec
CHANGED
@@ -4,24 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'increments/schedule/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'increments-schedule'
|
8
8
|
spec.version = Increments::Schedule::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Yuji Nakayama']
|
10
|
+
spec.email = ['nkymyj@gmail.com']
|
11
11
|
|
12
12
|
spec.summary = "Increments' schedule"
|
13
13
|
spec.description = spec.summary
|
14
14
|
spec.homepage = 'https://github.com/increments/increments-schedule'
|
15
|
-
spec.license =
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
|
-
spec.files
|
18
|
-
spec.bindir =
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_runtime_dependency '
|
23
|
-
spec.add_runtime_dependency 'holiday_japan'
|
22
|
+
spec.add_runtime_dependency 'holiday_japan', '~> 1.1'
|
24
23
|
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
27
25
|
end
|
data/lib/increments/schedule.rb
CHANGED
@@ -1,23 +1,22 @@
|
|
1
|
-
require
|
2
|
-
require 'active_support/all'
|
1
|
+
require 'increments/schedule/version'
|
3
2
|
require 'holiday_japan'
|
4
3
|
|
5
4
|
module Increments
|
6
5
|
module Schedule
|
7
|
-
|
6
|
+
extend self # rubocop:disable ModuleFunction
|
8
7
|
|
9
8
|
[
|
10
|
-
[:each_remote_work_day,
|
11
|
-
[:each_normal_remote_work_day,
|
12
|
-
[:each_special_remote_work_day,
|
13
|
-
].each do |
|
14
|
-
define_method(
|
9
|
+
[:each_remote_work_day, :remote_work_day?],
|
10
|
+
[:each_normal_remote_work_day, :normal_remote_work_day?],
|
11
|
+
[:each_special_remote_work_day, :special_remote_work_day?]
|
12
|
+
].each do |enumeration_method, predicate_method|
|
13
|
+
define_method(enumeration_method) do |max_date = nil, &block|
|
15
14
|
return to_enum(__method__, max_date) unless block
|
16
15
|
|
17
|
-
max_date ||= Date.today +
|
16
|
+
max_date ||= Date.today + 365
|
18
17
|
|
19
18
|
Date.today.upto(max_date) do |date|
|
20
|
-
block.call(date) if
|
19
|
+
block.call(date) if send(predicate_method, date)
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
@@ -27,16 +26,16 @@ module Increments
|
|
27
26
|
end
|
28
27
|
|
29
28
|
def normal_remote_work_day?(date)
|
30
|
-
date.monday?
|
29
|
+
date.monday? && !rest_day?(date)
|
31
30
|
end
|
32
31
|
|
33
32
|
def special_remote_work_day?(date)
|
34
|
-
|
35
|
-
!
|
33
|
+
normal_office_work_day?(date) &&
|
34
|
+
!normal_office_work_day?(date - 1) && !normal_office_work_day?(date + 1)
|
36
35
|
end
|
37
36
|
|
38
37
|
def office_work_day?(date)
|
39
|
-
|
38
|
+
normal_office_work_day?(date) && !remote_work_day?(date)
|
40
39
|
end
|
41
40
|
|
42
41
|
def rest_day?(date)
|
@@ -50,5 +49,11 @@ module Increments
|
|
50
49
|
def holiday?(date)
|
51
50
|
HolidayJapan.check(date)
|
52
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def normal_office_work_day?(date)
|
56
|
+
!rest_day?(date) && !normal_remote_work_day?(date)
|
57
|
+
end
|
53
58
|
end
|
54
59
|
end
|
metadata
CHANGED
@@ -1,71 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: increments-schedule
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: holiday_japan
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
17
|
- - "~>"
|
46
18
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
48
|
-
type: :
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
49
21
|
prerelease: false
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
51
23
|
requirements:
|
52
24
|
- - "~>"
|
53
25
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
26
|
+
version: '1.1'
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
28
|
+
name: bundler
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
31
|
- - "~>"
|
60
32
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
33
|
+
version: '1.3'
|
62
34
|
type: :development
|
63
35
|
prerelease: false
|
64
36
|
version_requirements: !ruby/object:Gem::Requirement
|
65
37
|
requirements:
|
66
38
|
- - "~>"
|
67
39
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
40
|
+
version: '1.3'
|
69
41
|
description: Increments' schedule
|
70
42
|
email:
|
71
43
|
- nkymyj@gmail.com
|
@@ -74,6 +46,9 @@ extensions: []
|
|
74
46
|
extra_rdoc_files: []
|
75
47
|
files:
|
76
48
|
- ".gitignore"
|
49
|
+
- ".rspec"
|
50
|
+
- ".rubocop.yml"
|
51
|
+
- ".travis.yml"
|
77
52
|
- Gemfile
|
78
53
|
- LICENSE.txt
|
79
54
|
- README.md
|