Class: ProcessMap
- Inherits:
-
Object
- Object
- ProcessMap
- Defined in:
- lib/processmap.rb
Instance Method Summary collapse
- #dodo(do_block) ⇒ Object
- #generateMap(phash) ⇒ Object
- #genLayouts(hoo, elements) ⇒ Object
- #getType(item, elements) ⇒ Object
- #layoutText(k, items, elements) ⇒ Object
- #printnav(nav_array) ⇒ Object
Instance Method Details
#dodo(do_block) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/processmap.rb', line 32 def dodo(do_block) text = "" if (do_block != :nothing) text = ":do => :#{do_block}," end text end |
#generateMap(phash) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/processmap.rb', line 2 def generateMap(phash) map ="" map << "channels\n" map << "\tchannel :default\n" map << "\t\tprocesses\n" map << "\t\t\tworkflow_steps\n" phash.each do |k,v| map << "\t\t\t\tstep :#{k},\t\t\t\t\t {#{dodo(v[:do])}:template => :#{k},:layout => :blank}\n" end map << "\t\t\tendworkflow_steps\n" map << "\t\t\tvalid_flows\n" phash.each do |k,v| map << "\t\t\t\tflow :#{k},\t\t\t\t\t [#{printnav(v[:navigation])}]\n" end map << "\t\t\tendvalid_flows\n" map << "\t\tendprocesses\n" map << "\tendchannel\n" map end |
#genLayouts(hoo, elements) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/processmap.rb', line 40 def genLayouts(hoo,elements) result = Array.new hoo.each do |k,v| layout = Array.new layout[0] = k layout[1] = layoutText(k,v[:data_model],elements) result.push layout end result end |
#getType(item, elements) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/processmap.rb', line 77 def getType(item,elements) elements.each do |e| if (e.name == "#{item}") return e.type == "entities" ? "entity" : "coverage" end end end |
#layoutText(k, items, elements) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/processmap.rb', line 51 def layoutText(k,items,elements) text = "" text << "layout 21\n" text << "\tcolumns\n" text << "\t\tcolumn 1\n" text << "\t\t\twidget :logo\n" text << "\t\t\tendwidget\n" text << "\t\t\twidget :page_title, {:title => :#{k}_page_title}\n" text << "\t\t\tendwidget \n" text << "\t\t\twidget :submit_panel\n" items.each do |i| text << "\t\t\t\twidget :extending_panel,{:title => :#{i}}\n" text << "\t\t\t\t\t#{getType(i,elements)} :#{i}\n" text << "\t\t\t\tendwidget \n" end text << "\t\t\twidget :button_panel\n" text << "\t\t\tendwidget \n" text << "\t\tendwidget \n" text << "\t\tendcolumn\n" text << "\tendcolumns\n" text << "footer\n" text << "endfooter\n" text << "endlayout\n" text end |
#printnav(nav_array) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/processmap.rb', line 22 def printnav(nav_array) text = "" comma = "" nav_array.each do |n| text << comma+":#{n}" comma = "," end text end |