daily_planner 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d58b6a0721e04c206913343c2ab860ce837f752
4
- data.tar.gz: b9b43c23a70ad631b36bbbbec900ab9ff9fadce2
3
+ metadata.gz: d9af46a5832bbbf1a032e4df76866c8ec6a10e32
4
+ data.tar.gz: 259d22dbf34252fac923958b1075811b574c35ea
5
5
  SHA512:
6
- metadata.gz: ac30b235e8a1afe78441e175716b6860a6db68202965f7d409caa4c37c3cef1def9801bd50856005acb6dd920099b5242ca6d9ba97b93b934b937b438d0819fc
7
- data.tar.gz: 5c05bcd0ebbe61274630dbfe759ee9357cef834de30e9c4c2a6e18ae8060b758908056e55593b076730eec17e5e558c4f23642930da5d15e006fa7ff35c83462
6
+ metadata.gz: 756eb36fb1f333f1bf38850cb067d80d17cf7f5160f4843eeccc762c80a4ef22b853b37dacd58e6305f0fd8bfb78a3c30653258d72fb0a5d9f460ca42c05fa2f
7
+ data.tar.gz: c64c8dc8115b369e32b9eaf565ff2005e9e9e23d9439c20563ebe21eefb30fa8071157dbb4f6a3f4730c7a273fc44065ef6cc4691e57d2e7f56847ab475f67d3
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/daily_planner.rb CHANGED
@@ -11,9 +11,10 @@ class DailyPlanner
11
11
 
12
12
  attr_reader :to_s
13
13
 
14
- def initialize(filename='daily-planner.txt', path: '.')
14
+ def initialize(filename='daily-planner.txt', path: '.',
15
+ now: DateTime.now.to_date)
15
16
 
16
- @filename, @path = filename, path
17
+ @filename, @path, @now = filename, path, now
17
18
 
18
19
  fpath = File.join(path, filename)
19
20
 
@@ -24,7 +25,7 @@ class DailyPlanner
24
25
  archive()
25
26
 
26
27
  # if the date isn't today then update it to today
27
- refresh() if @d != DateTime.now.to_date
28
+ refresh() if @d != @now
28
29
 
29
30
  else
30
31
  @rx = new_rx
@@ -106,18 +107,22 @@ class DailyPlanner
106
107
  def new_rx(today: '', tomorrow: '')
107
108
 
108
109
  title = "Daily Planner"
109
- date = DateTime.now
110
- rx = RecordX.new({title: title, date: date, \
110
+ rx = RecordX.new({title: title, date: @now, \
111
111
  today: today, tomorrow: tomorrow})
112
112
  return rx
113
113
  end
114
114
 
115
115
  def refresh()
116
-
117
- if @d == DateTime.now.to_date - 1 and @rx.tomorrow.strip.length > 0 then
118
- @rx = new_rx(today: @rx.tomorrow)
119
- end
120
116
 
117
+ if @d != @now then
118
+
119
+ @rx = if @d == @now - 1 and @rx.tomorrow.strip.length > 0 then
120
+ new_rx(today: @rx.tomorrow)
121
+ else
122
+ new_rx()
123
+ end
124
+
125
+ end
121
126
  end
122
127
 
123
128
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daily_planner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file