Class: DepViz::Item
- Inherits:
-
Object
- Object
- DepViz::Item
- Defined in:
- lib/depviz.rb
Instance Method Summary collapse
- #dependencies ⇒ Object
-
#initialize(s, root: nil, name: name, debug: false) ⇒ Item
constructor
A new instance of Item.
- #reverse_dependencies ⇒ Object
Constructor Details
Instance Method Details
#dependencies ⇒ Object
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/depviz.rb', line 19 def dependencies() if @debug then puts 'inside DepViz::Item::dependencies' puts '@s: ' + @s.inspect puts '@root: ' + @root.inspect end a = LineTree.new(@s).to_doc.root.xpath('//' + @name) puts 'dep: a: ' + a.inspect if @debug a2 = a.map do |x| puts ' dependencies x: ' + x.inspect if @debug x.backtrack.to_s.split('/')[1..-1] end puts 'a2: ' + a2.inspect if @debug s = a2.map {|x| x.map.with_index {|y,i| ' ' * i + y }.join("\n")}\ .join("\n") puts 'child s: ' + s.inspect if @debug dv3 = DepViz.new() dv3.read s dv3 end |
#reverse_dependencies ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/depviz.rb', line 46 def reverse_dependencies() a = LineTree.new(@s, root: @root).to_doc.root.xpath('//' + @name) s = a.select {|x| x.has_elements? }\ .map{|x| XmlToSliml.new(x).to_s }.join("\n") return if s.empty? dv3 = DepViz.new(root: nil) dv3.read s dv3 end |