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.49 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.48 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.47 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.46 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.45 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.44 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.43 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.42 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.41 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.40 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.39 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.38 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.37 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.36 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.35 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.34 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.33 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.32 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.31 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.30 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb