Module: RPV::Swing::EventHandlerMixin::ClassMethods
- Defined in:
- lib/rpv/swing/event_handler_mixin.rb
Instance Method Summary collapse
- #publish_defaults ⇒ Object
- #publish_events(options = nil) ⇒ Object
- #publish_events_for(components = nil, options = {}) ⇒ Object
Instance Method Details
#publish_defaults ⇒ Object
10 11 12 13 |
# File 'lib/rpv/swing/event_handler_mixin.rb', line 10 def publish_defaults @publish_defaults = { :events => :action_performed } if @publish_defaults.nil? @publish_defaults end |
#publish_events(options = nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rpv/swing/event_handler_mixin.rb', line 15 def publish_events( = nil) @publish_events ||= [] unless .nil? unless [:events].is_a? Hash events = [[:events]].flatten [:events] = {} events.each do |event| [:events][event] = event end end @publish_events << { :options => } [:events].each do |event, as| fires "#{as}".to_sym end end @publish_events end |
#publish_events_for(components = nil, options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rpv/swing/event_handler_mixin.rb', line 33 def publish_events_for(components = nil, = {}) @publish_events_for ||= [] unless components.nil? components = [components].flatten = || {} = publish_defaults.merge() unless [:events].is_a? Hash events = [[:events]].flatten [:events] = {} events.each do |event| [:events][event] = event end end @publish_events_for << { :components => components, :options => } components.each do |component| [:events].each do |event, as| fires "#{component}_#{as}".to_sym end end end @publish_events_for end |