timeboss 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timeboss/calendar/period.rb +78 -7
- data/lib/timeboss/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfac166bdd92d5f95689183603c5af386100642526cea8cbc405765655a1eb26
|
4
|
+
data.tar.gz: 00dfb8323ed9317cb214f532a7431bb9dc40d0ca3027ecda5f922bf72949ff0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf61f841ed2aa51150656da6d849b01a44511e478a8a0012e0074ec9a85fee8569a0bd162c22f3105b33d565c863df556bbee8bb65ea8d9b938272ff4b702b76
|
7
|
+
data.tar.gz: 1dff56f1577ab2e91eb4b5fcfee2928979c261ae02812eec1d2ab0c8788bd7078fbba7f95aec56c830f219d3c07f92513402cd3bb9035233283ffabdcb17fb0e
|
@@ -34,25 +34,96 @@ module TimeBoss
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
#
|
38
|
+
# i hate this
|
39
|
+
#
|
40
|
+
|
41
|
+
### Days
|
42
|
+
|
43
|
+
# @!method days
|
44
|
+
# Get a list of days that fall within this period.
|
45
|
+
# @return [Array<Calendar::Day>]
|
46
|
+
|
47
|
+
# @!method day(index = nil)
|
48
|
+
# Get the day this period represents.
|
49
|
+
# Returns nil if no single day can be identified.
|
50
|
+
# @return [Array<Calendar::Day>, nil]
|
51
|
+
|
52
|
+
### Weeks
|
53
|
+
|
54
|
+
# @!method weeks
|
55
|
+
# Get a list of weeks that fall within this period.
|
56
|
+
# @return [Array<Calendar::Week>]
|
57
|
+
|
58
|
+
# @!method week(index = nil)
|
59
|
+
# Get the week this period represents.
|
60
|
+
# Returns nil if no single week can be identified.
|
61
|
+
# @return [Array<Calendar::Week>, nil]
|
62
|
+
|
63
|
+
### Months
|
64
|
+
|
65
|
+
# @!method months
|
66
|
+
# Get a list of months that fall within this period.
|
67
|
+
# @return [Array<Calendar::Month>]
|
68
|
+
|
69
|
+
# @!method month(index = nil)
|
70
|
+
# Get the month this period represents.
|
71
|
+
# Returns nil if no single month can be identified.
|
72
|
+
# @return [Array<Calendar::Month>, nil]
|
73
|
+
|
74
|
+
### Quarters
|
75
|
+
|
76
|
+
# @!method quarters
|
77
|
+
# Get a list of quarters that fall within this period.
|
78
|
+
# @return [Array<Calendar::Quarter>]
|
79
|
+
|
80
|
+
# @!method quarter(index = nil)
|
81
|
+
# Get the quarter this period represents.
|
82
|
+
# Returns nil if no single quarter can be identified.
|
83
|
+
# @return [Array<Calendar::Quarter>, nil]
|
84
|
+
|
85
|
+
### Halves
|
86
|
+
|
87
|
+
# @!method halves
|
88
|
+
# Get a list of halves that fall within this period.
|
89
|
+
# @return [Array<Calendar::Half>]
|
90
|
+
|
91
|
+
# @!method half(index = nil)
|
92
|
+
# Get the half this period represents.
|
93
|
+
# Returns nil if no single half can be identified.
|
94
|
+
# @return [Array<Calendar::Half>, nil]
|
95
|
+
|
96
|
+
### Years
|
97
|
+
|
98
|
+
# @!method years
|
99
|
+
# Get a list of years that fall within this period.
|
100
|
+
# @return [Array<Calendar::Year>]
|
101
|
+
|
102
|
+
# @!method year(index = nil)
|
103
|
+
# Get the year this period represents.
|
104
|
+
# Returns nil if no single year can be identified.
|
105
|
+
# @return [Array<Calendar::Year>, nil]
|
106
|
+
|
107
|
+
# Does this period cover the current date?
|
108
|
+
# @return [Boolean]
|
109
|
+
def current?
|
110
|
+
to_range.include?(Date.today)
|
111
|
+
end
|
112
|
+
|
37
113
|
%w[day week month quarter half year].each do |size|
|
38
114
|
define_method(size.pluralize) do
|
39
115
|
entry = calendar.send("#{size}_for", self.begin.start_date)
|
40
116
|
build_entries entry
|
41
117
|
end
|
42
118
|
|
43
|
-
define_method(size) do
|
119
|
+
define_method(size) do |index = nil|
|
44
120
|
entries = send(size.pluralize)
|
121
|
+
return entries[index - 1] unless index.nil?
|
45
122
|
return nil unless entries.length == 1
|
46
123
|
entries.first
|
47
124
|
end
|
48
125
|
end
|
49
126
|
|
50
|
-
# Does this period cover the current date?
|
51
|
-
# @return [Boolean]
|
52
|
-
def current?
|
53
|
-
to_range.include?(Date.today)
|
54
|
-
end
|
55
|
-
|
56
127
|
# Express this period as a date range.
|
57
128
|
# @return [Range<Date, Date>]
|
58
129
|
def to_range
|
data/lib/timeboss/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeboss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McDonald
|
@@ -199,8 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '0'
|
201
201
|
requirements: []
|
202
|
-
|
203
|
-
rubygems_version: 2.7.7
|
202
|
+
rubygems_version: 3.0.8
|
204
203
|
signing_key:
|
205
204
|
specification_version: 4
|
206
205
|
summary: Broadcast Calendar navigation in Ruby made simple
|