Module: Card::Set::All::EventViz
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod007-05_standard/all/event_viz.rb
Instance Method Summary collapse
-
#events(action) ⇒ Object
up in the tree.
- #events_tree(filt) ⇒ Object
-
#puts_events(events, prefix = '', depth = 0) ⇒ Object
private.
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_module_list, #process_base_modules, #register_set, #write_tmp_file
Methods included from Helpers
#abstract_set?, #all_set?, #attachment, #ensure_set, #include_set, #include_set_formats, #shortname, #stage_method
Methods included from Format
#all_set_format_mod!, #applicable_format?, #define_on_format, #each_format, #format, #register_set_format, #view
Methods included from Trait
#card_accessor, #card_reader, #card_writer
Methods included from Event
Instance Method Details
#events(action) ⇒ Object
up in the tree.
16 17 18 19 20 21 |
# File 'tmpsets/set/mod007-05_standard/all/event_viz.rb', line 16 def events action @action = action events = [ events_tree(:validation), events_tree(:save) ] @action = nil puts_events events end |
#events_tree(filt) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'tmpsets/set/mod007-05_standard/all/event_viz.rb', line 53 def events_tree filt hash = {name: filt } if respond_to? "_#{filt}_callbacks" send( "_#{filt}_callbacks" ).each do |callback| next unless callback.applies? self hash[callback.kind] ||= [] hash[callback.kind] << events_tree( callback.filter ) end end hash end |
#puts_events(events, prefix = '', depth = 0) ⇒ Object
private
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'tmpsets/set/mod007-05_standard/all/event_viz.rb', line 25 def puts_events events, prefix='', depth=0 r = '' depth += 1 events.each do |e| space = ' ' * (depth * 2) #FIXME - this is not right. before and around callbacks are processed in declaration order regardless of kind. # not all befores then all arounds if e[:before] r += puts_events( e[:before], space+'v ', depth) end if e[:around] r += puts_events( e[:around], space+'vv ', depth ) end output = "#{prefix}#{e[:name]}" #warn output r+= "#{output}\n" if e[:after] r += puts_events( e[:after ].reverse, space+'^ ', depth ) end end r end |