Class: FileTreeXML

Inherits:
Object
  • Object
show all
Defined in:
lib/filetree_xml.rb

Instance Method Summary collapse

Constructor Details

#initialize(x) ⇒ FileTreeXML

Returns a new instance of FileTreeXML.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/filetree_xml.rb', line 12

def initialize(x)

  case x.strip
  when /^<\?polyrex/
    @px = Polyrex.new
    @px.import x
  else
    @px = Polyrex.new x

  end

end

Instance Method Details

#ls(path = '.') ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/filetree_xml.rb', line 25

def ls(path='.')

  a = path.split('/')

  xpath = if a.length > 1 then
    a.map {|x| "records/file[summary/title='%s']" % x }.join('/')
  else
    path 
  end

  @px.xpath xpath + '/records/file/summary/title/text()'
end