timeboss 0.3.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -6
- data/lib/timeboss/calendar/period.rb +4 -0
- data/lib/timeboss/calendar/support/unit.rb +4 -0
- data/lib/timeboss/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0d4b9c100b0d59e5aa5b71152c390f59deedce0e071c0d5c82666dba445946d
|
4
|
+
data.tar.gz: dc533dd7884b186571322d2229823f47da014a623a1f50535a7c723f4d6c355c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0acc27cc7254a3e0d67df651ddf2462bb606e2e844e7076bf36fd9c5ce0eacb2ccf08963ee418f41204c60c6acd6d0783fed60871b4729b46870c6f133de28f3
|
7
|
+
data.tar.gz: '0281773958cbad85a0b10997c3ed058797906a5fed2f5452a572922492cabf27021871ea018aec5e8b85e078803a750a7f004f1d2b04ec1d6518002c0552360a'
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ You can ask simple questions of the calendar:
|
|
40
40
|
|
41
41
|
```ruby
|
42
42
|
period = calendar.parse('2019Q4') # or '2018', or '2019-12-21', or '2020W32', or '2020M3W2'
|
43
|
-
# => #<TimeBoss::Calendar::Quarter
|
43
|
+
# => #<TimeBoss::Calendar::Quarter start_date=2019-09-30, end_date=2019-12-29>
|
44
44
|
period.to_s
|
45
45
|
# => "2019Q4: 2019-09-30 thru 2019-12-29"
|
46
46
|
period.next.start_date.to_s # try previous, too!
|
@@ -117,6 +117,9 @@ week = calendar.parse('2014W29').this_week
|
|
117
117
|
|
118
118
|
calendar.this_week.next_year.to_s # run 2020W29
|
119
119
|
# => "2021W29: 2021-07-12 thru 2021-07-18"
|
120
|
+
|
121
|
+
calendar.week(2016, this_week.in_year) # run 2020-07-22
|
122
|
+
# => #<TimeBoss::Calendar::Week start_date=2016-07-18, end_date=2016-07-24>
|
120
123
|
```
|
121
124
|
|
122
125
|
Complicated range expressions can be parsed using the `..` range operator, or evaluated with `thru`:
|
@@ -147,9 +150,9 @@ You will find yourself in the context of an instantiated `TimeBoss::Calendar` ob
|
|
147
150
|
```bash
|
148
151
|
$ tbsh
|
149
152
|
2.4.1 :001 > next_quarter
|
150
|
-
=> #<TimeBoss::Calendar::Quarter
|
153
|
+
=> #<TimeBoss::Calendar::Quarter start_date=2020-09-28, end_date=2020-12-27>
|
151
154
|
2.4.1 :002 > last_year
|
152
|
-
=> #<TimeBoss::Calendar::Year
|
155
|
+
=> #<TimeBoss::Calendar::Year start_date=2018-12-31, end_date=2019-12-29>
|
153
156
|
2.4.1 :003 > parse('this_quarter .. this_quarter+4').months.map(&:name)
|
154
157
|
=> ["2020M7", "2020M8", "2020M9", "2020M10", "2020M11", "2020M12", "2021M1", "2021M2", "2021M3", "2021M4", "2021M5", "2021M6", "2021M7", "2021M8", "2021M9"]
|
155
158
|
```
|
@@ -228,6 +231,3 @@ With the new calendar implemented, it can be accessed in one of 2 ways:
|
|
228
231
|
calendar = TimeBoss::Calendars[:august_fiscal]
|
229
232
|
calendar.this_year
|
230
233
|
```
|
231
|
-
|
232
|
-
## TODO
|
233
|
-
- [ ] Add comprehensive documentation
|
@@ -130,6 +130,10 @@ module TimeBoss
|
|
130
130
|
@_to_range ||= start_date .. end_date
|
131
131
|
end
|
132
132
|
|
133
|
+
def inspect
|
134
|
+
"#<#{self.class.name}[#{self.begin.inspect}..#{self.end.inspect}] start_date=#{start_date}, end_date=#{end_date}>"
|
135
|
+
end
|
136
|
+
|
133
137
|
private
|
134
138
|
|
135
139
|
attr_reader :calendar
|
data/lib/timeboss/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeboss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McDonald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|