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.
34
35
36
37
38
|
# File 'lib/automatic/opml.rb', line 34
def initialize
@attr = {}
@parent = nil
@children = []
end
|
Instance Attribute Details
#attr ⇒ Object
Returns the value of attribute attr.
40
41
42
|
# File 'lib/automatic/opml.rb', line 40
def attr
@attr
end
|
#children ⇒ Object
Returns the value of attribute children.
40
41
42
|
# File 'lib/automatic/opml.rb', line 40
def children
@children
end
|
#parent ⇒ Object
Returns the value of attribute parent.
39
40
41
|
# File 'lib/automatic/opml.rb', line 39
def parent
@parent
end
|
Instance Method Details
#<<(elem) ⇒ Object
51
52
53
54
55
|
# File 'lib/automatic/opml.rb', line 51
def <<(elem)
elem.parent = self if elem.respond_to? :parent=
@children << elem
self
end
|
#[](n) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/automatic/opml.rb', line 57
def [](n)
if n.is_a? String
@attr[n]
else
@children[n]
end
end
|
#[]=(k, v) ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/automatic/opml.rb', line 65
def []=(k,v)
if k.is_a? String
@attr[k] = v
else
@children[k] = v
end
end
|
#each {|_self| ... } ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/automatic/opml.rb', line 42
def each
yield self
@children.each {|c|
c.each {|x|
yield x
}
}
end
|
#is_breaakpoint? ⇒ Boolean
85
86
87
|
# File 'lib/automatic/opml.rb', line 85
def is_breaakpoint?
@attr['isBreakpoint']=='true'
end
|
81
82
83
|
# File 'lib/automatic/opml.rb', line 81
def
@attr['isComment']=='true'
end
|
#text ⇒ Object
73
74
75
|
# File 'lib/automatic/opml.rb', line 73
def text
@attr['text']
end
|
#type ⇒ Object
77
78
79
|
# File 'lib/automatic/opml.rb', line 77
def type
@attr['type']
end
|