work_day 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/work_day/version.rb +1 -1
- data/lib/work_day.rb +12 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21d50aa093439ef7e32a14eb8c858b3f6a6e9d16
|
4
|
+
data.tar.gz: a41a3f371aa76ebfbf6eea560fd8a8e39ca92f54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58ebd92aee207b27534b5239427fb2c8afde29e51c0392f2c486637a4a930972856020a7ac650e804f2fd6020740d0a325d4e52b02cdb01e7170601875d04227
|
7
|
+
data.tar.gz: 6b97c360f0859aecb989fb745af5e31a67918c309c5e7897bcc8b87e665d02686652ba67dad100c3d84074f3b209e968b2407f234cb88b5a38f5d65faa669750
|
data/lib/work_day/version.rb
CHANGED
data/lib/work_day.rb
CHANGED
@@ -5,11 +5,11 @@ require 'active_support'
|
|
5
5
|
require 'active_support/core_ext'
|
6
6
|
|
7
7
|
class WorkDay
|
8
|
-
|
8
|
+
include Singleton
|
9
|
+
attr_accessor :calendars
|
9
10
|
|
10
|
-
def
|
11
|
-
|
12
|
-
@holidays = {}
|
11
|
+
def self.calendars(calendars)
|
12
|
+
instance.calendars = calendars
|
13
13
|
end
|
14
14
|
|
15
15
|
def work_day?(date)
|
@@ -41,24 +41,27 @@ class WorkDay
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.work_day?(date)
|
44
|
-
WorkDay.
|
44
|
+
WorkDay.instance.work_day?(date)
|
45
45
|
end
|
46
46
|
|
47
47
|
def self.last_until(date, days = 0)
|
48
|
-
WorkDay.
|
48
|
+
WorkDay.instance.last_until(date, days)
|
49
49
|
end
|
50
50
|
|
51
51
|
def self.next_after(date, days = 1)
|
52
|
-
WorkDay.
|
52
|
+
WorkDay.instance.next_after(date, days)
|
53
53
|
end
|
54
54
|
|
55
55
|
def self.between(start_date, end_date)
|
56
|
-
WorkDay.
|
56
|
+
WorkDay.instance.between(start_date, end_date)
|
57
57
|
end
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
61
|
def holidays_in(year)
|
62
|
-
@
|
62
|
+
@calendars ||= ['brazil']
|
63
|
+
@holidays ||= {}
|
64
|
+
@holidays[calendars] ||= {}
|
65
|
+
@holidays[calendars][year] ||= Holiday.new(calendars).in(year)
|
63
66
|
end
|
64
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: work_day
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adriano Bacha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.4.8
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: work days
|