Class: Automatic::OPML::DOM::Element

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/automatic/opml.rb

Direct Known Subclasses

Body, Head, OPML, Outline

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeElement

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

#attrObject (readonly)

Returns the value of attribute attr.



41
42
43
# File 'lib/automatic/opml.rb', line 41

def attr
  @attr
end

#childrenObject (readonly)

Returns the value of attribute children.



41
42
43
# File 'lib/automatic/opml.rb', line 41

def children
  @children
end

#parentObject

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

Yields:

  • (_self)

Yield Parameters:



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

Returns:

  • (Boolean)


86
87
88
# File 'lib/automatic/opml.rb', line 86

def is_breaakpoint?
  @attr['isBreakpoint']=='true'
end

#is_comment?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/automatic/opml.rb', line 82

def is_comment?
  @attr['isComment']=='true'
end

#textObject



74
75
76
# File 'lib/automatic/opml.rb', line 74

def text
  @attr['text']
end

#typeObject



78
79
80
# File 'lib/automatic/opml.rb', line 78

def type
  @attr['type']
end