Class: Wolfram::Pod::State
- Inherits:
-
Object
- Object
- Wolfram::Pod::State
- Defined in:
- lib/wolfram/pod.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ State
constructor
A new instance of State.
- #inspect ⇒ Object
- #refetch ⇒ Object
- #requery ⇒ Object
- #to_query(key) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ State
Returns a new instance of State.
82 83 84 85 86 |
# File 'lib/wolfram/pod.rb', line 82 def initialize(name, = {}) @query = [:query] @input = [:input] @name = name end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
74 75 76 |
# File 'lib/wolfram/pod.rb', line 74 def input @input end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
74 75 76 |
# File 'lib/wolfram/pod.rb', line 74 def name @name end |
Class Method Details
.collection(xml, options = {}) ⇒ Object
76 77 78 79 80 |
# File 'lib/wolfram/pod.rb', line 76 def self.collection(xml, = {}) Nokogiri::XML(xml.to_s).search('state').map {|s_xml| new(s_xml['name'], .merge(:input => s_xml['input'])) } end |
Instance Method Details
#inspect ⇒ Object
96 97 98 |
# File 'lib/wolfram/pod.rb', line 96 def inspect "#<State: #{to_s}>" end |
#refetch ⇒ Object
105 106 107 |
# File 'lib/wolfram/pod.rb', line 105 def refetch requery.fetch end |
#requery ⇒ Object
100 101 102 103 |
# File 'lib/wolfram/pod.rb', line 100 def requery podstate = @query.params[:podstate] ? [@query.params[:podstate], input] : input Query.new(@query.input, @query..merge(:podstate => podstate)) end |
#to_query(key) ⇒ Object
88 89 90 |
# File 'lib/wolfram/pod.rb', line 88 def to_query(key) Util.to_query(name, key) end |
#to_s ⇒ Object
92 93 94 |
# File 'lib/wolfram/pod.rb', line 92 def to_s "[#{name}...]" end |