Class: Riddl::Wrapper::Declaration::Tile
- Inherits:
-
Object
- Object
- Riddl::Wrapper::Declaration::Tile
- Defined in:
- lib/ruby/riddl/wrapper/declaration/tile.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
- #add_description(des, desres, path, index, interface, block, rec = nil, res = @base_path) ⇒ Object
- #base_path(path) ⇒ Object
- #compose!(res = @base_path) ⇒ Object
-
#initialize ⇒ Tile
constructor
{{.
- #visualize(mode, res = @resource, what = '') ⇒ Object
Constructor Details
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
101 102 103 |
# File 'lib/ruby/riddl/wrapper/declaration/tile.rb', line 101 def resource @resource end |
Instance Method Details
#add_description(des, desres, path, index, interface, block, rec = nil, res = @base_path) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ruby/riddl/wrapper/declaration/tile.rb', line 46 def add_description(des,desres,path,index,interface,block,rec=nil,res=@base_path) #{{{ res = add_path(path,res,rec) res.add_access_methods(des,desres,index,interface) res.add_custom(desres) desres.find("des:resource").each do |tdesres| cpath = tdesres.attributes['relative'] || "{}" rec = tdesres.attributes['recursive'] int = Interface.new_from_interface(interface,(interface.sub+"/"+cpath).gsub(/\/+/,'/')) add_description(des,tdesres,cpath,index,int,block,rec,res) end block.each do |bl| bpath = bl.to_s.gsub(/\/+/,'/').gsub(/\/$/,'') bpath = (bpath == "" ? "/" : bpath) if path == bpath res.remove_access_methods(des,bl.attributes,index) end end nil #}}} end |
#base_path(path) ⇒ Object
91 92 93 94 95 96 97 98 99 |
# File 'lib/ruby/riddl/wrapper/declaration/tile.rb', line 91 def base_path(path) #{{{ if path.nil? || path == '/' @base_path else @base_path = add_path(path,@base_path) end #}}} end |
#compose!(res = @base_path) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/ruby/riddl/wrapper/declaration/tile.rb', line 68 def compose!(res=@base_path) #{{{ res.compose! res.resources.each do |k,r| compose!(r) end #}}} end |
#visualize(mode, res = @resource, what = '') ⇒ Object
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 40 41 42 43 44 |
# File 'lib/ruby/riddl/wrapper/declaration/tile.rb', line 14 def visualize(mode,res=@resource,what='') #{{{ what += res.path puts what if mode == :layers res.access_methods.each do |k,v| puts " #{k.to_s.upcase}:" v.each_with_index do |l,i| puts " Layer #{i}:" l.each do |r| puts " #{r.class.name.gsub(/[^\:]+::/,'')}: #{r.visualize}" end unless l.nil? end end end if mode == :composition res.composition.each do |k,v| puts " #{k.to_s.upcase}:" v.each do |r| puts " #{r.result.class.name.gsub(/[^\:]+::/,'')}: #{r.result.visualize}" r.route.each do |ritem| puts " #{ritem.class.name.gsub(/[^\:]+::/,'')}: #{ritem.visualize}" end unless r.route.nil? end end end res.resources.each do |key,r| visualize(mode,r,what + (what == '/' ? '' : '/')) end #}}} end |