reminders_txt 0.3.7 → 0.3.8

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: 1092a4de1fbdc34444d6d9dcb92bea5e4fbf73d4
4
- data.tar.gz: 5f1f05c6a3c8b8d0b744c39b14cdae771f24eb5b
3
+ metadata.gz: 0b16db43889591e5c776d8b7f79bcd8b5d7d7039
4
+ data.tar.gz: 07ed00f327fc580d3afc3892344ac9bc218565d7
5
5
  SHA512:
6
- metadata.gz: e2a84c28265f0c7e9c038927e4e0aafde74a6f625797efb24397ed6148ea6d0990754420bc2c82c55e2a3b11514c009b7651121f990e9b40aae7f319aa0a42f6
7
- data.tar.gz: bd863d4f8fd03ec2bb558ed0190c88d938936c0939b81926570130e1ca9940ba424fccc51eacbfe3afa7cc8e3e574af086451f6c19bc37fe66ba3d4c02aeb793
6
+ metadata.gz: 7455ef7df8b4c2fc2801af36369aad634cbf5d45b0ce328c5be02c2931036d176d23368e132c6356c93ef80d6761758aa7df663000929358798e4bc52c1a09a0
7
+ data.tar.gz: 1c3c7b39b49ad4525b4f4fc7a180bc5eae89b5aa074395c7e18cd4eddcf36b50a031dce63d7790c2d638ae7f71d05975786a2bed3ac810ffb0f1046b629b89f5
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -11,7 +11,7 @@ require 'chronic_cron'
11
11
 
12
12
  module Ordinals
13
13
 
14
- refine Fixnum do
14
+ refine Integer do
15
15
  def ordinal
16
16
  self.to_s + ( (10...20).include?(self) ? 'th' :
17
17
  %w{ th st nd rd th th th th th th }[self % 10] )
@@ -27,23 +27,26 @@ class RemindersTxt
27
27
 
28
28
  attr_reader :reminders
29
29
 
30
- def initialize(filepath='reminders.txt', now: Time.now)
30
+ def initialize(raw_s='reminders.txt', now: Time.now)
31
31
 
32
32
  super()
33
33
 
34
34
  @now = now
35
- @filepath = filepath
35
+ @filepath = raw_s
36
36
 
37
- if File.extname(filepath) == '.txt' then
38
- import_txt(filepath)
37
+ if raw_s.lines.length > 1 then
38
+ @filepath = 'reminders.xml'
39
+ @dx = Dynarex.new raw_s
40
+ elsif File.extname(@filepath) == '.txt'
41
+ import_txt(@filepath)
39
42
  refresh()
40
43
  else
41
- @dx = Dynarex.new filepath
44
+ @dx = Dynarex.new @filepath
42
45
  end
43
46
  end
44
47
 
45
48
  def upcoming(ndays=5, days: ndays)
46
- @dx.filter {|x| Date.parse(x.date) <= Date.today + days}
49
+ @dx.filter {|x| Date.parse(x.date) <= @now.to_date + days.to_i}
47
50
  end
48
51
 
49
52
  def updated?()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reminders_txt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  n+SSd9dm8JjhZ2pqHtX+bgMZ18hrN06xfR+UPtk5BKC8v1PC0FWxaVR4lom39rFU
32
32
  seDxJNsJgamAKg==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-12-24 00:00:00.000000000 Z
34
+ date: 2016-12-25 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
metadata.gz.sig CHANGED
Binary file