gnu-remind 0.1.3 → 0.1.5
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 +4 -4
 - data/lib/remind/version.rb +1 -1
 - data/lib/remind.rb +28 -10
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c8302802a937430ef1ad975d6616ec60e3426f571ab67362f618396623184469
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bab3dbb5c8cec7b55e84caa4e30bb7f31fccf60feb9ebfec9232c796d98cc438
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 432e323c67bb3b876db61bc967bb2dedabee7ff5ed2f73a3fce029f9c2f1efb00b28464c7ebf6d4a64827fa8345ce1da5b3163e81956cca1fb796c7c999b9921
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f7757d9b561d015faa63880d888447739b2a6317e462cc1b65a9f794309e81ebe11f8ff45fba35b76b519ae4e0fa35fe9e0949ee1c687cf5440e8a3252d80927
         
     | 
    
        data/lib/remind/version.rb
    CHANGED
    
    
    
        data/lib/remind.rb
    CHANGED
    
    | 
         @@ -13,27 +13,42 @@ require_relative "remind/calendar" 
     | 
|
| 
       13 
13 
     | 
    
         
             
            module Remind
         
     | 
| 
       14 
14 
     | 
    
         
             
              class Error < StandardError; end
         
     | 
| 
       15 
15 
     | 
    
         
             
              @@REM = REM['reminders']
         
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
              @@INIT = []
         
     | 
| 
      
 17 
     | 
    
         
            +
              @@URL = []
         
     | 
| 
      
 18 
     | 
    
         
            +
              def self.init h={}
         
     | 
| 
      
 19 
     | 
    
         
            +
                @@INIT << h
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
              
         
     | 
| 
      
 22 
     | 
    
         
            +
              def self.url u
         
     | 
| 
      
 23 
     | 
    
         
            +
                @@URL << u
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
      
 26 
     | 
    
         
            +
              def self.rebuild!
         
     | 
| 
       19 
27 
     | 
    
         
             
                @@REM.clear!
         
     | 
| 
       20 
     | 
    
         
            -
                [ 
     | 
| 
       21 
     | 
    
         
            -
                  r[x[:what]].attr = { date: x[:when] }
         
     | 
| 
      
 28 
     | 
    
         
            +
                [@@INIT].flatten.each do |x|
         
     | 
| 
       22 
29 
     | 
    
         
             
                  @@REM[x[:what]].attr = { date: x[:when] }
         
     | 
| 
       23 
30 
     | 
    
         
             
                end
         
     | 
| 
       24 
     | 
    
         
            -
                 
     | 
| 
       25 
     | 
    
         
            -
                  CAL.from_url( 
     | 
| 
      
 31 
     | 
    
         
            +
                @@URL.each do |u|
         
     | 
| 
      
 32 
     | 
    
         
            +
                  CAL.from_url(u).each do |e|
         
     | 
| 
      
 33 
     | 
    
         
            +
                    d = e.when[:begin].to_time.localtime.strftime("%Y/%m/%d-%R")
         
     | 
| 
       26 
34 
     | 
    
         
             
                    h = {
         
     | 
| 
       27 
35 
     | 
    
         
             
                      date: e.when[:begin].to_time.localtime.strftime("%-d %b %Y"),
         
     | 
| 
       28 
36 
     | 
    
         
             
                      hour: e.when[:begin].to_time.localtime.strftime("%k"),
         
     | 
| 
       29 
37 
     | 
    
         
             
                      minute: e.when[:begin].to_time.localtime.strftime("%M"),
         
     | 
| 
       30 
38 
     | 
    
         
             
                      at: e.where,
         
     | 
| 
       31 
     | 
    
         
            -
                      type: e.who
         
     | 
| 
      
 39 
     | 
    
         
            +
                      type: e.who,
         
     | 
| 
      
 40 
     | 
    
         
            +
                      lead: 1
         
     | 
| 
       32 
41 
     | 
    
         
             
                    }
         
     | 
| 
       33 
     | 
    
         
            -
                     
     | 
| 
       34 
     | 
    
         
            -
                    @@REM[ 
     | 
| 
      
 42 
     | 
    
         
            +
                    k = %[#{e.what} #{h[:type]} #{d}]
         
     | 
| 
      
 43 
     | 
    
         
            +
                    @@REM[k].attr = h
         
     | 
| 
       35 
44 
     | 
    
         
             
                  end
         
     | 
| 
       36 
45 
     | 
    
         
             
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              def self.remote x, u
         
     | 
| 
      
 49 
     | 
    
         
            +
                r = REM[x]
         
     | 
| 
      
 50 
     | 
    
         
            +
                r.clear!
         
     | 
| 
      
 51 
     | 
    
         
            +
                Remind.rebuild!
         
     | 
| 
       37 
52 
     | 
    
         
             
                CAL.from_url(u).each do |e|
         
     | 
| 
       38 
53 
     | 
    
         
             
                  d = e.when[:begin].to_time.localtime.strftime("%Y/%m/%d-%R")
         
     | 
| 
       39 
54 
     | 
    
         
             
                  h = {
         
     | 
| 
         @@ -53,10 +68,13 @@ module Remind 
     | 
|
| 
       53 
68 
     | 
    
         
             
                @@REM.to_rem!
         
     | 
| 
       54 
69 
     | 
    
         
             
                return nil
         
     | 
| 
       55 
70 
     | 
    
         
             
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
              
         
     | 
| 
       56 
72 
     | 
    
         
             
              def self.[] k
         
     | 
| 
       57 
73 
     | 
    
         
             
                REM[k].agenda[1..-1]
         
     | 
| 
       58 
74 
     | 
    
         
             
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       59 
76 
     | 
    
         
             
              def self.all
         
     | 
| 
      
 77 
     | 
    
         
            +
                @@REM.to_rem!
         
     | 
| 
       60 
78 
     | 
    
         
             
                @@REM.agenda[1..-1]
         
     | 
| 
       61 
79 
     | 
    
         
             
              end
         
     | 
| 
       62 
80 
     | 
    
         
             
            end
         
     |