module UIC
Public Class Methods
Application(metadata,uia_path=nil)
click to toggle source
Create a new {UIC::Application}. Shortcut for `UIC::Application.new(…)` @param metadata [UIC::MetaData] the MetaData
to use for this application. @param uia_path [String] a path to the .uia to load. @return [UIC::Application]
# File lib/ruic/application.rb, line 214 def Application(metadata,uia_path=nil) UIC::Application.new( metadata, uia_path ) end
MetaData(metadata_path)
click to toggle source
# File lib/ruic/assets.rb, line 355 def UIC.MetaData(metadata_path) raise %Q{Cannot find MetaData.xml at "#{metadata_path}"} unless File.exist?(metadata_path) UIC::MetaData.new(File.read(metadata_path,encoding:'utf-8')) end
Presentation( uip_path=nil )
click to toggle source
@param uip_path [String] Path to the `.uip` presentation file on disk to load. @return [Presentation] Shortcut for `UIC::Presentation.new`
# File lib/ruic/presentation.rb, line 642 def UIC.Presentation( uip_path=nil ) UIC::Presentation.new( uip_path ) end
StateMachine( scxml_path )
click to toggle source
# File lib/ruic/statemachine.rb, line 11 def UIC.StateMachine( scxml_path ) UIC::StateMachine.new(File.read(scxml_path,encoding:'utf-8')) .tap{ |o| o.file = scxml_path } end
tree_hierarchy( root, &children )
click to toggle source
Create an array of rows representing a tree of elements. @param root [Object] the root of the tree. @param children [Block] a block that returns an array of child objects when passed an item in the tree. @return [Array<Array>] array of lines pairing the indent string for the line with the element, or `nil` if the indent line is a separator.
# File lib/ruic/interfaces.rb, line 124 def UIC.tree_hierarchy( root, &children ) queue = [[root,"",true]] [].tap do |results| until queue.empty? item,indent,last = queue.pop kids = children[item] extra = indent.empty? ? '' : last ? '\\-' : '|-' results << [ indent+extra, item ] results << [ indent, nil ] if last and kids.empty? indent += last ? ' ' : '| ' parts = kids.map{ |k| [k,indent,false] }.reverse parts.first[2] = true unless parts.empty? queue.concat parts end end end