class WAB::UI::Flow
A controller that provides a description of the UI
for the WAB
UI
reference implementation.
Attributes
displays[R]
entry[RW]
Public Class Methods
new(shell)
click to toggle source
Calls superclass method
WAB::Controller::new
# File lib/wab/ui/flow.rb, line 12 def initialize(shell) super @displays = {} end
Public Instance Methods
add_display(display, entry=false)
click to toggle source
Adds a display to the flow.
# File lib/wab/ui/flow.rb, line 18 def add_display(display, entry=false) name = display.name raise DuplicateError.new(name) if @displays.has_key?(name) @displays[name] = display @entry = name if entry end
get_display(name)
click to toggle source
# File lib/wab/ui/flow.rb, line 25 def get_display(name) @displays[name] end
read(path, _query)
click to toggle source
Returns a description of the UI
to be used. If a display name is includd in the path thenn just that display description is returned.
- path
-
array of tokens in the path.
# File lib/wab/ui/flow.rb, line 33 def read(path, _query) results = [] path_pos = @shell.path_pos if path_pos + 2 == path.length # Return the description of the named display. name = path[path_pos + 1] display = get_display(name) display[:entry] = true if !display.nil? && display.name == @entry results << {id: name, data: display.spec} unless display.nil? else @displays.each_value { |display| spec = display.spec spec[:entry] = true if display.name == @entry results << spec } end @shell.data({code: 0, results: results}) end