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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfac166bdd92d5f95689183603c5af386100642526cea8cbc405765655a1eb26
4
- data.tar.gz: 00dfb8323ed9317cb214f532a7431bb9dc40d0ca3027ecda5f922bf72949ff0d
3
+ metadata.gz: b0d4b9c100b0d59e5aa5b71152c390f59deedce0e071c0d5c82666dba445946d
4
+ data.tar.gz: dc533dd7884b186571322d2229823f47da014a623a1f50535a7c723f4d6c355c
5
5
  SHA512:
6
- metadata.gz: bf61f841ed2aa51150656da6d849b01a44511e478a8a0012e0074ec9a85fee8569a0bd162c22f3105b33d565c863df556bbee8bb65ea8d9b938272ff4b702b76
7
- data.tar.gz: 1dff56f1577ab2e91eb4b5fcfee2928979c261ae02812eec1d2ab0c8788bd7078fbba7f95aec56c830f219d3c07f92513402cd3bb9035233283ffabdcb17fb0e
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:0x007f82d50e2478>
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:0x007fe04c16a1c8 @calendar=#<TimeBoss::Calendars::Broadcast:0x007fe04c1a0458 @basis=TimeBoss::Calendars::Broadcast::Basis>, @year_index=2020, @index=4, @start_date=#<Date: 2020-09-28 ((2459121j,0s,0n),+0s,2299161j)>, @end_date=#<Date: 2020-12-27 ((2459211j,0s,0n),+0s,2299161j)>>
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:0x007fe04c161ca8 @calendar=#<TimeBoss::Calendars::Broadcast:0x007fe04c1a0458 @basis=TimeBoss::Calendars::Broadcast::Basis>, @year_index=2019, @index=1, @start_date=#<Date: 2018-12-31 ((2458484j,0s,0n),+0s,2299161j)>, @end_date=#<Date: 2019-12-29 ((2458847j,0s,0n),+0s,2299161j)>>
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
@@ -82,6 +82,10 @@ module TimeBoss
82
82
  def to_range
83
83
  @_to_range ||= start_date .. end_date
84
84
  end
85
+
86
+ def inspect
87
+ "#<#{self.class.name} start_date=#{start_date}, end_date=#{end_date}>"
88
+ end
85
89
  end
86
90
  end
87
91
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module TimeBoss
3
- VERSION = "0.3.1"
3
+ VERSION = "1.0.0"
4
4
  end
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.3.1
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-21 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport