Module: Relyze::Symbols::StaticLibraryPackage::TSortPackageArray
- Defined in:
- C:/Program Files/Relyze/lib/relyze/core/symbols.rb
Overview
Use a topological sort to order an Array of package option Hash objects based on their children dependencies. The children may either be Relyze::Symbols::StaticLibraryPackage objects or package name strings.
Class Method Summary collapse
Instance Method Summary collapse
- #locate(name, package) ⇒ Object
- #tsort_each_child(package, &block) ⇒ Object
- #tsort_each_node(&block) ⇒ Object
Class Method Details
.init ⇒ Object
[View source]
19 20 21 22 |
# File 'C:/Program Files/Relyze/lib/relyze/core/symbols.rb', line 19 def self.init include( ::TSort ) return self end |
Instance Method Details
#locate(name, package) ⇒ Object
[View source]
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'C:/Program Files/Relyze/lib/relyze/core/symbols.rb', line 38 def locate( name, package ) platform = (package.class == ::Hash ? package[:platform] : package.platform) mode = (package.class == ::Hash ? package[:mode] : package.mode) arch = (package.class == ::Hash ? package[:arch] : package.arch) self.each do | next_package | next_name = (next_package.class == ::Hash ? next_package[:name] : next_package.name) next_platform = (next_package.class == ::Hash ? next_package[:platform] : next_package.platform) next_mode = (next_package.class == ::Hash ? next_package[:mode] : next_package.mode) next_arch = (next_package.class == ::Hash ? next_package[:arch] : next_package.arch) if( next_name == name and next_platform == platform and next_mode == mode and next_arch == arch ) return next_package end end end |
#tsort_each_child(package, &block) ⇒ Object
[View source]
30 31 32 33 34 35 36 |
# File 'C:/Program Files/Relyze/lib/relyze/core/symbols.rb', line 30 def tsort_each_child( package, &block ) if( not package[:children].nil? ) package[:children].each do | child | yield self.locate( (child.class == ::String ? child : child.name), package ) end end end |
#tsort_each_node(&block) ⇒ Object
[View source]
24 25 26 27 28 |
# File 'C:/Program Files/Relyze/lib/relyze/core/symbols.rb', line 24 def tsort_each_node( &block ) self.each do | package | yield package end end |