Class: Plex::Parser
- Inherits:
-
Object
- Object
- Plex::Parser
- Defined in:
- lib/plex-ruby/parser.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(parent, node) ⇒ Parser
constructor
A new instance of Parser.
-
#parse ⇒ Array, ...
Parses a XML node and returns the structure it represents.
Constructor Details
#initialize(parent, node) ⇒ Parser
Returns a new instance of Parser.
8 9 10 11 |
# File 'lib/plex-ruby/parser.rb', line 8 def initialize(parent, node) @parent = parent @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/plex-ruby/parser.rb', line 4 def node @node end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/plex-ruby/parser.rb', line 4 def parent @parent end |
Instance Method Details
#parse ⇒ Array, ...
Parses a XML node and returns the structure it represents. This is currently used to parse Sections as we don’t know whether a Section holds a list of Shows or a list of Movies. The parsing is done recursively.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/plex-ruby/parser.rb', line 20 def parse case node.name when 'document' Plex::Parser.new(parent, node.root).parse when 'MediaContainer' parse_media_container when 'Video' parse_video when 'Directory' parse_directory when 'text' nil else end end |