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.94 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.93 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.92 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.91 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.90 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.89 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.88 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.87 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.86 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.85 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.84 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.83 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.82 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.81 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.80 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.79 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.78 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.77 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.75 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb
knjrbfw-0.0.74 lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb