wolfram 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemspec +1 -1
- data/CHANGELOG.rdoc +3 -0
- data/lib/wolfram/pod.rb +7 -9
- data/lib/wolfram/query.rb +2 -2
- data/lib/wolfram/result.rb +5 -1
- data/lib/wolfram/util.rb +1 -0
- data/lib/wolfram/version.rb +1 -1
- metadata +5 -4
data/.gemspec
CHANGED
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) + "/lib/wolfram/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "wolfram"
|
7
7
|
s.version = Wolfram::VERSION
|
8
|
-
s.authors = ["Gabriel Horner"]
|
8
|
+
s.authors = ["Gabriel Horner", "Ian White"]
|
9
9
|
s.email = "gabriel.horner@gmail.com"
|
10
10
|
s.homepage = "http://github.com/cldwalker/wolfram"
|
11
11
|
s.summary = "Wolfram V2 API client"
|
data/CHANGELOG.rdoc
CHANGED
data/lib/wolfram/pod.rb
CHANGED
@@ -52,7 +52,7 @@ module Wolfram
|
|
52
52
|
include XmlContainer
|
53
53
|
|
54
54
|
def self.collection(xml, options = {})
|
55
|
-
Nokogiri::XML(xml.to_s).search('subpod').map {|s_xml| new(s_xml, options)}
|
55
|
+
Nokogiri::XML(xml.to_s).search('subpod').map {|s_xml| new(s_xml, options) }
|
56
56
|
end
|
57
57
|
|
58
58
|
def initialize(xml, options = {})
|
@@ -71,14 +71,17 @@ module Wolfram
|
|
71
71
|
end
|
72
72
|
|
73
73
|
class State
|
74
|
-
attr_reader :name
|
74
|
+
attr_reader :name, :input
|
75
75
|
|
76
76
|
def self.collection(xml, options = {})
|
77
|
-
Nokogiri::XML(xml.to_s).search('state').map {|s_xml|
|
77
|
+
Nokogiri::XML(xml.to_s).search('state').map {|s_xml|
|
78
|
+
new(s_xml['name'], options.merge(:input => s_xml['input']))
|
79
|
+
}
|
78
80
|
end
|
79
81
|
|
80
82
|
def initialize(name, options = {})
|
81
83
|
@query = options[:query]
|
84
|
+
@input = options[:input]
|
82
85
|
@name = name
|
83
86
|
end
|
84
87
|
|
@@ -95,12 +98,7 @@ module Wolfram
|
|
95
98
|
end
|
96
99
|
|
97
100
|
def requery
|
98
|
-
|
99
|
-
podstate = State.new("#{podstate.name},#{name}", :query => @query)
|
100
|
-
else
|
101
|
-
podstate = self
|
102
|
-
end
|
103
|
-
|
101
|
+
podstate = @query.params[:podstate] ? [@query.params[:podstate], input] : input
|
104
102
|
Query.new(@query.input, @query.options.merge(:podstate => podstate))
|
105
103
|
end
|
106
104
|
|
data/lib/wolfram/query.rb
CHANGED
data/lib/wolfram/result.rb
CHANGED
@@ -5,7 +5,7 @@ module Wolfram
|
|
5
5
|
include Enumerable
|
6
6
|
extend Util
|
7
7
|
|
8
|
-
delegate :
|
8
|
+
delegate :each, :to => :pods
|
9
9
|
delegate :uri, :to => :query
|
10
10
|
|
11
11
|
attr_reader :assumptions, :pods, :query
|
@@ -19,6 +19,10 @@ module Wolfram
|
|
19
19
|
types.each {|mod| extend mod}
|
20
20
|
end
|
21
21
|
|
22
|
+
def [](key)
|
23
|
+
key.is_a?(String) ? pods.find {|e| e.title == key } : pods[key]
|
24
|
+
end
|
25
|
+
|
22
26
|
def success?
|
23
27
|
success
|
24
28
|
end
|
data/lib/wolfram/util.rb
CHANGED
data/lib/wolfram/version.rb
CHANGED
metadata
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wolfram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gabriel Horner
|
14
|
+
- Ian White
|
14
15
|
autorequire:
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-01
|
19
|
+
date: 2011-02-01 00:00:00 -05:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|