rdf-do 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README +2 -0
  2. data/VERSION +1 -1
  3. data/lib/rdf/do.rb +13 -30
  4. data/lib/rdf/do/version.rb +1 -1
  5. metadata +12 -12
data/README CHANGED
@@ -32,6 +32,8 @@ The greatly preferred installation method is via RubyGems:
32
32
 
33
33
  Manual downloads are available at <http://github.com/bhuga/rdf-do/downloads>
34
34
 
35
+ Ruby 1.8.6 is not supported, but the tests pass with the backports gem. Godspeed.
36
+
35
37
  ## Connecting:
36
38
  require 'do_postgres'
37
39
  require 'do_sqlite3'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
data/lib/rdf/do.rb CHANGED
@@ -195,7 +195,7 @@ module RDF
195
195
  # @param [Proc] &block
196
196
  # @return [Enumerable::Enumerator, void]
197
197
  def each(&block)
198
- return RDF::Enumerator.new(self,:each) unless block_given?
198
+ return enum_for(:each) unless block_given?
199
199
  reader = result(@adapter.each_sql)
200
200
  while reader.next!
201
201
  block.call(RDF::Statement.new(
@@ -213,7 +213,7 @@ module RDF
213
213
  # @param [Proc] &block
214
214
  # @return [Enumerable::Enumerator, void]
215
215
  def each_subject(&block)
216
- return RDF::Enumerator.new(self,:each_subject) unless block_given?
216
+ return enum_for(:each_subject) unless block_given?
217
217
  reader = result(@adapter.each_subject_sql)
218
218
  while reader.next!
219
219
  block.call(unserialize(reader.values[0]))
@@ -227,7 +227,7 @@ module RDF
227
227
  # @param [Proc] &block
228
228
  # @return [Enumerable::Enumerator, void]
229
229
  def each_predicate(&block)
230
- return RDF::Enumerator.new(self,:each_predicate) unless block_given?
230
+ return enum_for(:each_predicate) unless block_given?
231
231
  reader = result(@adapter.each_predicate_sql)
232
232
  while reader.next!
233
233
  block.call(unserialize(reader.values[0]))
@@ -241,7 +241,7 @@ module RDF
241
241
  # @param [Proc] &block
242
242
  # @return [Enumerable::Enumerator, void]
243
243
  def each_object(&block)
244
- return RDF::Enumerator.new(self,:each_object) unless block_given?
244
+ return enum_for(:each_object) unless block_given?
245
245
  reader = result(@adapter.each_object_sql)
246
246
  while reader.next!
247
247
  block.call(unserialize(reader.values[0]))
@@ -255,7 +255,7 @@ module RDF
255
255
  # @param [Proc] &block
256
256
  # @return [Enumerable::Enumerator, void]
257
257
  def each_context(&block)
258
- return RDF::Enumerator.new(self,:each_context) unless block_given?
258
+ return enum_for(:each_context) unless block_given?
259
259
  reader = result(@adapter.each_context_sql)
260
260
  while reader.next!
261
261
  context = unserialize(reader.values[0])
@@ -274,32 +274,15 @@ module RDF
274
274
  # @param [RDF::Statement, Hash, Array] pattern
275
275
  # @return [RDF::Enumerable, void]
276
276
  # @see RDF::Queryable#query
277
- def query(pattern, &block)
278
- case pattern
279
- when RDF::Statement
280
- query(pattern.to_hash, &block)
281
- when Array
282
- query(RDF::Statement.new(*pattern), &block)
283
- when Hash
284
- statements = []
285
- reader = @adapter.query(self,pattern)
286
- while reader.next!
287
- statements << RDF::Statement.new(
288
- :subject => unserialize(reader.values[0]),
289
- :predicate => unserialize(reader.values[1]),
290
- :object => unserialize(reader.values[2]),
291
- :context => unserialize(reader.values[3]))
292
- end
293
- case block_given?
294
- when true
295
- statements.each(&block)
296
- else
297
- statements.extend(RDF::Enumerable, RDF::Queryable)
298
- end
299
- else
300
- super(pattern)
277
+ def query_pattern(pattern, &block)
278
+ reader = @adapter.query(self,pattern.to_hash)
279
+ while reader.next!
280
+ yield RDF::Statement.new(
281
+ :subject => unserialize(reader.values[0]),
282
+ :predicate => unserialize(reader.values[1]),
283
+ :object => unserialize(reader.values[2]),
284
+ :context => unserialize(reader.values[3]))
301
285
  end
302
-
303
286
  end
304
287
 
305
288
  ##
@@ -2,7 +2,7 @@ module RDF::DataObjects
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 1
5
+ TINY = 2
6
6
  EXTRA = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ben Lavender
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-09 00:00:00 +02:00
17
+ date: 2010-06-18 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -22,13 +22,13 @@ dependencies:
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
28
  - 0
29
- - 1
30
- - 7
31
- version: 0.1.7
29
+ - 2
30
+ - 0
31
+ version: 0.2.0
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,8 @@ dependencies:
41
41
  segments:
42
42
  - 0
43
43
  - 10
44
- - 1
45
- version: 0.10.1
44
+ - 2
45
+ version: 0.10.2
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
@@ -50,13 +50,13 @@ dependencies:
50
50
  prerelease: false
51
51
  requirement: &id003 !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  segments:
56
56
  - 0
57
- - 1
57
+ - 2
58
58
  - 6
59
- version: 0.1.6
59
+ version: 0.2.6
60
60
  type: :development
61
61
  version_requirements: *id003
62
62
  - !ruby/object:Gem::Dependency