Sha256: 819b0f7277a40fba9bbfe7964c1817443baf4296f39047957e8ed5ba8be9808e

Contents?: true

Size: 1.29 KB

Versions: 101

Compression:

Stored size: 1.29 KB

Contents

class Knj
  class Maemo
    class FremantleCalendar
      def initialize
        require "knjrbfw/libknjphpfuncs.rb"
        
        require "knjrbfw/knjdb/libknjdb.rb"
        @db = KnjDB.new({
          "type" => "sqlite3",
          "path" => "/home/user/.calendar/calendardb"
        })
      end
      
      def events
        ret = []
        f_gevents = @db.query("SELECT * FROM Components ORDER BY DateStart")
        while(d_gevents = f_gevents.fetch)
          ret << Event.new({
            "cal" => self,
            "data" => d_gevents,
            "db" => @db
          })
        end
        
        return ret
      end
      
      class Event
        def data; return @data; end
        def db; return @db; end
        def cal; return @cal; end
        
        def initialize(paras)
          @db = paras["db"]
          @data = paras["data"]
          @cal = paras["cal"]
        end
        
        def [](key)
          if (!@data.key?(key))
            raise "No such key: '" + key + "'"
          end
          
          return @data[key]
        end
        
        def []=(key, value)
          self[key] #raises error if key is invalid.
          
          @db.update("Components", {key => value}, {"Id" => @data["Id"]})
          @data[key] = value
        end
      end
    end
  end
end

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
knjrbfw-0.0.72 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.71 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.70 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.69 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.68 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.67 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.66 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.65 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.64 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.63 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.62 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.59 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.58 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.57 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.55 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.54 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.53 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.52 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.51 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.50 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb