Module: UIC

Defined in:
lib/ruic.rb

Defined Under Namespace

Modules: ElementBacked, FileBacked, PresentableHash, XMLFileBacked Classes: Application, Behavior, Effect, MetaData, Presentation, Property, RenderPlugin, SlideCollection, SlideValues, StateMachine, ValuesPerSlide

Class Method Summary collapse

Class Method Details

.Application(metadata, uia_path = nil) ⇒ UIC::Application

Returns:



214
215
216
# File 'lib/ruic/application.rb', line 214

def Application(,uia_path=nil)
  UIC::Application.new( , uia_path )
end

.MetaData(metadata_path) ⇒ Object



355
356
357
358
# File 'lib/ruic/assets.rb', line 355

def UIC.()
  raise %Q{Cannot find MetaData.xml at "#{metadata_path}"} unless File.exist?()
  UIC::.new(File.read(,encoding:'utf-8'))
end

.Presentation(uip_path = nil) ⇒ Presentation

Returns Shortcut for UIC::Presentation.new.

Parameters:

  • uip_path (String) (defaults to: nil)

    Path to the .uip presentation file on disk to load.

Returns:



642
643
644
# File 'lib/ruic/presentation.rb', line 642

def UIC.Presentation( uip_path=nil )
  UIC::Presentation.new( uip_path )
end

.StateMachine(scxml_path) ⇒ Object



11
12
13
14
# 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) ⇒ Array<Array>

Create an array of rows representing a tree of elements.

Parameters:

  • root (Object)

    the root of the tree.

  • children (Block)

    a block that returns an array of child objects when passed an item in the tree.

Returns:

  • (Array<Array>)

    array of lines pairing the indent string for the line with the element, or nil if the indent line is a separator.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# 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