Class: Automatic::OPML::DOM::Element
- Inherits:
-
Object
- Object
- Automatic::OPML::DOM::Element
show all
- Includes:
- Enumerable
- Defined in:
- lib/automatic/opml.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Element.
35
36
37
38
39
|
# File 'lib/automatic/opml.rb', line 35
def initialize
@attr = {}
@parent = nil
@children = []
end
|
Instance Attribute Details
#attr ⇒ Object
Returns the value of attribute attr.
41
42
43
|
# File 'lib/automatic/opml.rb', line 41
def attr
@attr
end
|
#children ⇒ Object
Returns the value of attribute children.
41
42
43
|
# File 'lib/automatic/opml.rb', line 41
def children
@children
end
|
#parent ⇒ Object
Returns the value of attribute parent.
40
41
42
|
# File 'lib/automatic/opml.rb', line 40
def parent
@parent
end
|
Instance Method Details
#<<(elem) ⇒ Object
52
53
54
55
56
|
# File 'lib/automatic/opml.rb', line 52
def <<(elem)
elem.parent = self if elem.respond_to? :parent=
@children << elem
self
end
|
#[](n) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/automatic/opml.rb', line 58
def [](n)
if n.is_a? String
@attr[n]
else
@children[n]
end
end
|
#[]=(k, v) ⇒ Object
66
67
68
69
70
71
72
|
# File 'lib/automatic/opml.rb', line 66
def []=(k,v)
if k.is_a? String
@attr[k] = v
else
@children[k] = v
end
end
|
#each {|_self| ... } ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/automatic/opml.rb', line 43
def each
yield self
@children.each {|c|
c.each {|x|
yield x
}
}
end
|
#is_breaakpoint? ⇒ Boolean
86
87
88
|
# File 'lib/automatic/opml.rb', line 86
def is_breaakpoint?
@attr['isBreakpoint']=='true'
end
|
82
83
84
|
# File 'lib/automatic/opml.rb', line 82
def
@attr['isComment']=='true'
end
|
#text ⇒ Object
74
75
76
|
# File 'lib/automatic/opml.rb', line 74
def text
@attr['text']
end
|
#type ⇒ Object
78
79
80
|
# File 'lib/automatic/opml.rb', line 78
def type
@attr['type']
end
|