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
24
25
# File 'lib/filetree_xml.rb', line 12

def initialize(x)

  case x
  when x[/^<?polyrex/]

    @px = Polyrex.new

    @px.import s
  else 
    @px = Polyrex.new x

  end

end

Instance Method Details

#ls(path = '.') ⇒ Object



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

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