Class: Wolfram::Pod::Subpod
- Inherits:
-
Object
- Object
- Wolfram::Pod::Subpod
show all
- Includes:
- XmlContainer
- Defined in:
- lib/wolfram/pod.rb
Instance Attribute Summary
Attributes included from XmlContainer
#xml
Class Method Summary
collapse
Instance Method Summary
collapse
#respond_to?
Constructor Details
#initialize(xml, options = {}) ⇒ Subpod
Returns a new instance of Subpod.
58
59
60
61
62
|
# File 'lib/wolfram/pod.rb', line 58
def initialize(xml, options = {})
@query = options[:query]
@xml = Nokogiri::Slop(xml.to_s).search('subpod').first
@xml or raise MissingNodeError, "<subpod> node missing from xml: #{xml[0..20]}..."
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Wolfram::XmlContainer
Class Method Details
.collection(xml, options = {}) ⇒ Object
54
55
56
|
# File 'lib/wolfram/pod.rb', line 54
def self.collection(xml, options = {})
Nokogiri::XML(xml.to_s).search('subpod').map {|s_xml| new(s_xml, options) }
end
|
Instance Method Details
#img ⇒ Object
68
69
70
|
# File 'lib/wolfram/pod.rb', line 68
def img
xml.img
end
|
#plaintext ⇒ Object
64
65
66
|
# File 'lib/wolfram/pod.rb', line 64
def plaintext
(e = xml.plaintext) && e.text
end
|