Class: Atom::Pub::Service

Inherits:
Object
  • Object
show all
Includes:
Xml::Parseable
Defined in:
lib/atom/pub.rb

Instance Method Summary collapse

Methods included from Xml::Parseable

#==, #accessor_name, #current_node_is?, included, #next_node_is?, #parse, #to_xml

Constructor Details

#initialize(xml = nil) {|_self| ... } ⇒ Service

Returns a new instance of Service.

Yields:

  • (_self)

Yield Parameters:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/atom/pub.rb', line 40

def initialize(xml = nil)
  @workspaces = []

  if xml
    begin
      if next_node_is?(xml, 'service', Atom::Pub::NAMESPACE)
        xml.read
        parse(xml)
      else
        raise ArgumentError, "XML document was missing atom:service"        
      end
    ensure
      xml.close
    end
  end
  
  yield(self) if block_given?        
end