Module: MobyUtil::XML::Abstraction

Included in:
Attribute, Builder, Comment, Document, Element, NilNode, Nodeset, Text
Defined in:
lib/tdriver/util/xml/abstraction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object

TODO: document me

Raises:

  • (RuntimeError)


97
98
99
100
101
# File 'lib/tdriver/util/xml/abstraction.rb', line 97

def method_missing( *args )

  raise RuntimeError, "This is abstraction class of #{ self.class } - XML parser type was not specified correctly" 

end

Instance Attribute Details

#xmlObject

Returns the value of attribute xml.



26
27
28
# File 'lib/tdriver/util/xml/abstraction.rb', line 26

def xml
  @xml
end

Instance Method Details

#attribute?Boolean

TODO: document me

Returns:

  • (Boolean)


62
63
64
65
66
# File 'lib/tdriver/util/xml/abstraction.rb', line 62

def attribute?

  kind_of?( MobyUtil::XML::Attribute )

end

#clone!Object

TODO: document me



40
41
42
43
44
45
# File 'lib/tdriver/util/xml/abstraction.rb', line 40

def clone!

  # create a clone of self object, also xml object is cloned; note that all references (e.g. parent) will be disconnected
  self.class.new( @xml.clone )

end

#comment?Boolean

TODO: document me

Returns:

  • (Boolean)


48
49
50
51
52
# File 'lib/tdriver/util/xml/abstraction.rb', line 48

def comment?

  kind_of?( MobyUtil::XML::Comment )

end

#document?Boolean

TODO: document me

Returns:

  • (Boolean)


83
84
85
86
87
# File 'lib/tdriver/util/xml/abstraction.rb', line 83

def document?

  kind_of?( MobyUtil::XML::Document )

end

#element?Boolean

TODO: document me

Returns:

  • (Boolean)


76
77
78
79
80
# File 'lib/tdriver/util/xml/abstraction.rb', line 76

def element?

  kind_of?( MobyUtil::XML::Element )

end

#initialize(xml = nil, options = {}) ⇒ Object

TODO: document me



29
30
31
32
33
34
35
36
37
# File 'lib/tdriver/util/xml/abstraction.rb', line 29

def initialize( xml = nil, options = {} )

  @options = options

  @cache = Hash.new{ | hash, key | hash[ key ] = {} }

  @xml = xml

end

#inspectObject

print only object type and id hex



104
105
106
107
108
# File 'lib/tdriver/util/xml/abstraction.rb', line 104

def inspect

  "#<#{ self.class }:0x#{ ( "%x" % ( object_id.to_i << 1 ) )[ 3 .. -1 ] }>"
      
end

#nil?Boolean

TODO: document me

Returns:

  • (Boolean)


90
91
92
93
94
# File 'lib/tdriver/util/xml/abstraction.rb', line 90

def nil?

  kind_of?( MobyUtil::XML::NilNode )

end

#nodeset?Boolean

TODO: document me

Returns:

  • (Boolean)


69
70
71
72
73
# File 'lib/tdriver/util/xml/abstraction.rb', line 69

def nodeset?

  kind_of?( MobyUtil::XML::Nodeset )

end

#text?Boolean

TODO: document me

Returns:

  • (Boolean)


55
56
57
58
59
# File 'lib/tdriver/util/xml/abstraction.rb', line 55

def text?

  kind_of?( MobyUtil::XML::Text )

end