Sha256: 92b84d5c379ba80828365ceeff8dd811e3ed10ffd1b75b12fa11afad9998c7a8
Contents?: true
Size: 1.41 KB
Versions: 10
Compression:
Stored size: 1.41 KB
Contents
require 'bsearch' require 'time' module Rho module RhoEvent def self.find(*args) if args.first == :all params = {} if args.length >= 2 and args[1].is_a? Hash args[1].each do |k,v| params[k.to_s] = v end end params['start_date'] = MIN_TIME if params['start_date'].nil? or params['start_date'] < MIN_TIME params['end_date'] = MAX_TIME if params['end_date'].nil? or params['end_date'] > MAX_TIME params['include_repeating'] = false if ( params['start_date'] == MIN_TIME || params['end_date'] == MAX_TIME ) puts "Rho::Calendar.fetch(params) : #{params}" events = Rho::Calendar.fetch(params) #puts "events : #{events}" #ret = {} #events.each do |e| # ret[e[Rho::RhoEvent::ID]] = e #end #ret events else id = args.first.to_s id = $1 if id.is_a?(String) and id =~ /^{(.*)}$/ Rho::Calendar.fetch_by_id(id) end end def self.create!(event) event['id'] = nil #indicate that event should be created Rho::Calendar.save(event) end def self.destroy(id) id = $1 if id.is_a?(String) and id =~ /^{(.*)}$/ Rho::Calendar.delete(id) end def self.update_attributes(event) puts "update_attributes: #{event}" Rho::Calendar.save(event) end end # module RhoEvent end # module Rho
Version data entries
10 entries across 10 versions & 1 rubygems