Class: Hpricot::Elem

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

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object

Makes properties available as simple method calls.

Example:

print item.creationdate()


17
18
19
20
21
22
# File 'lib/webdavtools/hpricot_extensions.rb', line 17

def method_missing(method_name, *args)
  if(args.size == 0) then
    return property(method_name.to_s)
  end
  raise "Method missing"
end

Instance Method Details

#hrefObject

Resource url



25
26
27
# File 'lib/webdavtools/hpricot_extensions.rb', line 25

def href()
  self.at("d:href").innerText
end

#isCollection?Boolean

Returns true of resource is a collection, i.e. a folder and not a file.

Returns:

  • (Boolean)


30
31
32
# File 'lib/webdavtools/hpricot_extensions.rb', line 30

def isCollection?()
  self.at("d:collection") != nil
end