Class: Riddl::Wrapper::Declaration::Facade
- Inherits:
-
Object
- Object
- Riddl::Wrapper::Declaration::Facade
- Defined in:
- lib/ruby/riddl/wrapper/declaration/facade.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #description_xml(namespaces) ⇒ Object
-
#initialize ⇒ Facade
constructor
A new instance of Facade.
- #merge_tiles(res, fac = @resource) ⇒ Object
Constructor Details
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
6 7 8 |
# File 'lib/ruby/riddl/wrapper/declaration/facade.rb', line 6 def resource @resource end |
Instance Method Details
#description_xml(namespaces) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ruby/riddl/wrapper/declaration/facade.rb', line 12 def description_xml(namespaces) #{{{ namespaces = namespaces.delete_if do |k,n| k =~ /^xmlns\d+$/ || [Riddl::Wrapper::DESCRIPTION, Riddl::Wrapper::DECLARATION, Riddl::Wrapper::XINCLUDE].include?(n) end.map do |k,n| "xmlns:#{k}=\"#{n}\"" end.join(' ') result = "" = {} names = [] = "" description_result = "" description_xml_priv(result,,0) result = XML::Smart.string(result) .each do |hash,mess| t = mess.content.dup name = mess.name name += '_' while names.include?(name) result.find("//@*[.=#{hash}]").each { |e| e.value = name } names << name t.root.attributes['name'] = name << t.root.dump + "\n" end XML::Smart.string("<description #{Riddl::Wrapper::COMMON} #{namespaces}>\n\n" + description_result + .gsub(/^/,' ') + "\n" + result.root.dump + "\n</description>").to_s #}}} end |
#merge_tiles(res, fac = @resource) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ruby/riddl/wrapper/declaration/facade.rb', line 54 def merge_tiles(res,fac=@resource) #{{{ fac.custom = fac.custom + res.custom res.composition.each do |method,s| fac.composition[method] ||= [] fac.composition[method] += s end res.resources.each do |path,r| if !fac.resources.has_key?(path) fac.resources[path] = Riddl::Wrapper::Description::Resource.new(path,r.recursive) end merge_tiles(r,fac.resources[path]) end #}}} end |