Sha256: f09054ae4d953d922aaac92c6799688f1dde7e2202bb7cd3059a0fba448a3891
Contents?: true
Size: 1.62 KB
Versions: 4
Compression:
Stored size: 1.62 KB
Contents
require 'rubygems' require 'xml/mapping' require 'voruby/loader' require 'voruby/resources/nodes' require 'voruby/resources/voresource/voresource_v0_10' module VORuby module STC def self.dispatch_from_element_name(ns, override=nil) Proc.new{ |xml| name = (override)? override.call(xml.name): xml.name eval("#{ns}::#{name}.load_from_xml(xml)") } end def self.expand_group(sub_groups, group, expanded=[]) group_name = (group.is_a?(String))? group: group.to_s.split('::')[-1] return if !sub_groups.has_key?(group_name) sub_groups[group_name].each do |klass| expanded.push(klass) klass_name = klass.name.split('::')[-1] if sub_groups.has_key?(klass_name) sub_groups[klass_name].each do |sub_klass| expanded.push(sub_klass) sub_klass_name = sub_klass.name.split('::')[-1] expand_group(sub_groups, sub_klass, expanded) end end end return expanded end def self.group_members(sub_groups, group) group_name = (group.is_a?(String))? group: group.to_s.split('::')[-1] raise "Substition group #{group_name} does not exist" if !sub_groups.has_key?(group_name) return STC::expand_group(sub_groups, group) end def self.group_member_names(group, sub_groups, nsprefix=nil) return STC::group_members(sub_groups, group).collect{ |klass| element_name = klass.name.split('::')[-1] element_name = "#{nsprefix}:#{element_name}" if nsprefix element_name } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
voruby-1.0.1 | lib/voruby/stc/loader.rb |
voruby-1.1 | lib/voruby/stc/loader.rb |
voruby-1.0.2 | lib/voruby/stc/loader.rb |
voruby-1.1.1 | lib/voruby/stc/loader.rb |