Class: UpnpContentExplorer::Node
- Inherits:
-
Object
- Object
- UpnpContentExplorer::Node
show all
- Defined in:
- lib/upnp_content_explorer/node.rb
Constant Summary
collapse
- ROOT_ID =
'0'
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ Node
Returns a new instance of Node.
5
6
7
|
# File 'lib/upnp_content_explorer/node.rb', line 5
def initialize(data)
@data = data
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key) ⇒ Object
14
15
16
17
|
# File 'lib/upnp_content_explorer/node.rb', line 14
def method_missing(key)
return @data[key] if @data.has_key?(key)
super
end
|
Instance Method Details
#child(key) ⇒ Object
38
39
40
|
# File 'lib/upnp_content_explorer/node.rb', line 38
def child(key)
@data[:children][key]
end
|
#children ⇒ Object
30
31
32
|
# File 'lib/upnp_content_explorer/node.rb', line 30
def children
@data[:children].values || []
end
|
#item(key) ⇒ Object
42
43
44
|
# File 'lib/upnp_content_explorer/node.rb', line 42
def item(key)
@data[:items][key]
end
|
#items ⇒ Object
34
35
36
|
# File 'lib/upnp_content_explorer/node.rb', line 34
def items
@data[:items].values || []
end
|
#load!(data, mark_loaded = true) ⇒ Object
19
20
21
22
23
24
|
# File 'lib/upnp_content_explorer/node.rb', line 19
def load!(data, mark_loaded = true)
merged_data = @data.merge(data)
merged_data[:loaded?] ||= mark_loaded
@data = merged_data
end
|
#loaded? ⇒ Boolean
9
10
11
12
|
# File 'lib/upnp_content_explorer/node.rb', line 9
def loaded?
return false if @data[:loaded?].nil?
@data[:loaded?]
end
|
#parent_id ⇒ Object
26
27
28
|
# File 'lib/upnp_content_explorer/node.rb', line 26
def parent_id
@data[:parentID] || nil
end
|