Class: Riddl::Wrapper::Description

Inherits:
WrapperUtils show all
Defined in:
lib/ruby/riddl/wrapper/description.rb,
lib/ruby/riddl/wrapper/description/access.rb,
lib/ruby/riddl/wrapper/description/resource.rb,
lib/ruby/riddl/wrapper/description/message_and_transformation.rb

Defined Under Namespace

Classes: AccessBase, Composition, HashBase, Message, RequestInOut, RequestPass, RequestStarOut, RequestTransformation, Resource, SSE, Star, Transformation, WebSocket

Instance Method Summary collapse

Constructor Details

#initialize(riddl) ⇒ Description

Returns a new instance of Description.



58
59
60
61
62
63
64
65
66
# File 'lib/ruby/riddl/wrapper/description.rb', line 58

def initialize(riddl)
  #{{{
  @resource = Riddl::Wrapper::Description::Resource.new("/")
  @riddl = riddl
  des = riddl.root
  desres = des.find("/des:description/des:resource").first
  add_description(des,@resource,desres)
  #}}}
end

Instance Method Details

#get_resource(path) ⇒ Object



12
13
14
# File 'lib/ruby/riddl/wrapper/description.rb', line 12

def get_resource(path)
  get_resource_deep(path,@resource)
end

#paths(res = @resource, what = '') ⇒ Object



9
10
11
# File 'lib/ruby/riddl/wrapper/description.rb', line 9

def paths(res=@resource,what='')
  rpaths(res,what)
end

#visualize(res = @resource, what = '') ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ruby/riddl/wrapper/description.rb', line 16

def visualize(res=@resource,what='')
  #{{{
  what += res.path
  puts what
  res.access_methods.each do |k,v|
    puts "  #{k.upcase}:"
    v.each_with_index do |l,i|
      l.each do |r|
        puts "    #{r.class.name.gsub(/[^\:]+::/,'')}: #{r.visualize}"
      end
    end
  end
  res.resources.each do |key,r|
    visualize(r,what + (what == '/' ? ''  : '/'))
  end
  #}}}
end

#xmlObject



34
35
36
# File 'lib/ruby/riddl/wrapper/description.rb', line 34

def xml
  @riddl.to_s
end