class EventCache
this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
Public Instance Methods
gtkobject_events(gtkobjectid,event_name) { |event_command| ... }
click to toggle source
# File lib/Common/EventCache.rb, line 9 def gtkobject_events(gtkobjectid,event_name) goid=gtkobjectid.to_i @events=Hash.new if @events.nil? @events.delete(goid) if event_name.nil? unless @events.has_key?(goid) @events[goid]=Hash.new #load events for object a=ManqodDB.instance.cache.get("ev#{gtkobjectid}") a=Hash.new unless a.class.name == "Hash" a.each_pair{|ev_name,ev| @events[goid][ev_name]=ev.to_a } einfo("loaded #{a.size} events for #{goid}","events") end unless @events[goid].nil? || @events[goid][event_name].nil? einfo("serving from cache #{event_name} events for #{goid}","events") @events[goid][event_name].each{|event_command| yield event_command } end end
reload_events(gtkobjectid)
click to toggle source
# File lib/Common/EventCache.rb, line 32 def reload_events(gtkobjectid) @events=Hash.new if @events.nil? @events[gtkobjectid.to_i]=Hash.new unless @events.has_key?(gtkobjectid.to_i) gtkobject_events(gtkobjectid.to_i,nil) einfo("reloaded #{gtkobjectid}","events") end
to_s()
click to toggle source
# File lib/Common/EventCache.rb, line 39 def to_s;"EventCache";end