Class: Wolfram::Assumption
- Inherits:
-
Object
- Object
- Wolfram::Assumption
- Extended by:
- Util
- Includes:
- Enumerable, XmlContainer
- Defined in:
- lib/wolfram/assumption.rb
Defined Under Namespace
Classes: Value
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Attributes included from XmlContainer
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(xml, options = {}) ⇒ Assumption
constructor
A new instance of Assumption.
- #inspect ⇒ Object
- #name ⇒ Object
- #to_s ⇒ Object
Methods included from Util
delegate, module_get, to_param, to_query
Methods included from XmlContainer
Constructor Details
#initialize(xml, options = {}) ⇒ Assumption
Returns a new instance of Assumption.
14 15 16 17 18 19 20 |
# File 'lib/wolfram/assumption.rb', line 14 def initialize(xml, = {}) @query = [:query] @xml = Nokogiri::XML(xml.to_s).search('assumption').first @xml or raise MissingNodeError, "<assumption> node missing from xml: #{xml[0..20]}..." extend Util.module_get(Assumption, @xml['type']) @values = Value.collection(@xml, ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Wolfram::XmlContainer
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
13 14 15 |
# File 'lib/wolfram/assumption.rb', line 13 def values @values end |
Class Method Details
.collection(xml, options = {}) ⇒ Object
9 10 11 |
# File 'lib/wolfram/assumption.rb', line 9 def self.collection(xml, = {}) Nokogiri::XML(xml.to_s).search('assumptions').search('assumption').map {|a_xml| new(a_xml, )} end |
Instance Method Details
#inspect ⇒ Object
30 31 32 |
# File 'lib/wolfram/assumption.rb', line 30 def inspect "#<#{to_s}>" end |
#name ⇒ Object
22 23 24 |
# File 'lib/wolfram/assumption.rb', line 22 def name xml['type'] end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/wolfram/assumption.rb', line 26 def to_s name + ": " + values.map(&:desc).join(', ') end |