Class: Wolfram::Assumption::Value
- Inherits:
-
Object
- Object
- Wolfram::Assumption::Value
show all
- Includes:
- XmlContainer
- Defined in:
- lib/wolfram/assumption.rb
Instance Attribute Summary
Attributes included from XmlContainer
#xml
Class Method Summary
collapse
Instance Method Summary
collapse
#respond_to?
Constructor Details
#initialize(xml, options = {}) ⇒ Value
Returns a new instance of Value.
41
42
43
44
45
|
# File 'lib/wolfram/assumption.rb', line 41
def initialize(xml, options = {})
@query = options[:query]
@xml = Nokogiri::XML(xml.to_s).search('value').first
@xml or raise MissingNodeError, "<value> 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
37
38
39
|
# File 'lib/wolfram/assumption.rb', line 37
def self.collection(xml, options = {})
Nokogiri::XML(xml.to_s).search('value').map {|v_xml| new(v_xml, options)}
end
|
Instance Method Details
#inspect ⇒ Object
47
48
49
|
# File 'lib/wolfram/assumption.rb', line 47
def inspect
"#<#{to_s}>"
end
|
#refetch ⇒ Object
59
60
61
|
# File 'lib/wolfram/assumption.rb', line 59
def refetch
requery.fetch
end
|
#requery ⇒ Object
55
56
57
|
# File 'lib/wolfram/assumption.rb', line 55
def requery
Query.new(@query.input, @query.options.merge(:assumption => input))
end
|
#to_query(key) ⇒ Object
63
64
65
|
# File 'lib/wolfram/assumption.rb', line 63
def to_query(key)
Util.to_query(input, key)
end
|
#to_s ⇒ Object
51
52
53
|
# File 'lib/wolfram/assumption.rb', line 51
def to_s
desc
end
|