rdf 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
1
  module RDF; module Util
2
2
  ##
3
3
  # Wrapper for Kernel.open. Allows implementations to override to get
4
- # more suffisticated behavior for HTTP resources
4
+ # more suffisticated behavior for HTTP resources (e.g., Accept header).
5
+ #
6
+ # Also supports the file: scheme for access to local files.
5
7
  #
6
8
  # Classes include this module when they represent some form of a file
7
9
  # as a base resource, for instance an HTTP resource representing the
@@ -25,7 +27,8 @@ module RDF; module Util
25
27
  # @return [IO] File stream
26
28
  # @yield [IO] File stream
27
29
  def self.open_file(filename_or_url, options = {}, &block)
28
- Kernel.open(filename_or_url, &block)
30
+ filename_or_url = $1 if filename_or_url.to_s.match(/^file:(.*)$/)
31
+ f = Kernel.open(filename_or_url.to_s, &block)
29
32
  end
30
33
  end # File
31
34
  end; end # RDF::Util
@@ -2,7 +2,7 @@ module RDF
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 3
5
+ TINY = 4
6
6
  EXTRA = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
@@ -77,7 +77,7 @@ module RDF
77
77
  #
78
78
  # @return [Class]
79
79
  def self.for(options = {})
80
- if format = Format.for(options)
80
+ if format = self.format || Format.for(options)
81
81
  format.writer
82
82
  end
83
83
  end
@@ -107,7 +107,7 @@ module RDF
107
107
  # @param [IO, File] io
108
108
  # the output stream or file to write to
109
109
  # @param [Hash{Symbol => Object}] options
110
- # passed to {RDF::Writer.new} or {RDF::Writer.buffer}
110
+ # passed to {RDF::Writer#initialize} or {RDF::Writer.buffer}
111
111
  # @return [void]
112
112
  def self.dump(data, io = nil, options = {})
113
113
  io = File.open(io, 'w') if io.is_a?(String)
@@ -147,7 +147,7 @@ module RDF
147
147
  #
148
148
  # @param [String, #to_s] filename
149
149
  # @param [Hash{Symbol => Object}] options
150
- # any additional options (see {RDF::Writer#initialize and {RDF::Format.for}})
150
+ # any additional options (see {RDF::Writer#initialize} and {RDF::Format.for})
151
151
  # @option options [Symbol] :format (nil)
152
152
  # @return [RDF::Writer]
153
153
  def self.open(filename, options = {}, &block)
@@ -158,6 +158,23 @@ module RDF
158
158
  end
159
159
  end
160
160
 
161
+ ##
162
+ # Returns a symbol appropriate to use with RDF::Writer.for()
163
+ # @return [Symbol]
164
+ def self.to_sym
165
+ elements = self.to_s.split("::")
166
+ sym = elements.pop
167
+ sym = elements.pop if sym == 'Writer'
168
+ sym.downcase.to_s.to_sym
169
+ end
170
+
171
+ ##
172
+ # Returns a symbol appropriate to use with RDF::Writer.for()
173
+ # @return [Symbol]
174
+ def to_sym
175
+ self.class.to_sym
176
+ end
177
+
161
178
  ##
162
179
  # Initializes the writer.
163
180
  #
@@ -184,8 +201,8 @@ module RDF
184
201
  if block_given?
185
202
  write_prologue
186
203
  case block.arity
187
- when 0 then instance_eval(&block)
188
- else block.call(self)
204
+ when 1 then block.call(self)
205
+ else instance_eval(&block)
189
206
  end
190
207
  write_epilogue
191
208
  end
@@ -198,6 +215,18 @@ module RDF
198
215
  # @since 0.2.2
199
216
  attr_reader :options
200
217
 
218
+ ##
219
+ # Returns the base URI used for this writer.
220
+ #
221
+ # @example
222
+ # reader.prefixes[:dc] #=> RDF::URI('http://purl.org/dc/terms/')
223
+ #
224
+ # @return [Hash{Symbol => RDF::URI}]
225
+ # @since 0.3.4
226
+ def base_uri
227
+ @options[:base_uri]
228
+ end
229
+
201
230
  ##
202
231
  # Returns the URI prefixes currently defined for this writer.
203
232
  #
metadata CHANGED
@@ -1,93 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rdf
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 3
8
- - 3
9
- version: 0.3.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.4
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Arto Bendiken
13
9
  - Ben Lavender
14
10
  - Gregg Kellogg
15
11
  autorequire:
16
12
  bindir: bin
17
13
  cert_chain: []
18
-
19
- date: 2011-04-11 00:00:00 +02:00
20
- default_executable: rdf
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
14
+ date: 2011-09-16 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
23
17
  name: addressable
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: &2165535520 !ruby/object:Gem::Requirement
26
19
  none: false
27
- requirements:
28
- - - "="
29
- - !ruby/object:Gem::Version
30
- segments:
31
- - 2
32
- - 2
33
- - 4
34
- version: 2.2.4
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: 2.2.6
35
24
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: yard
39
25
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: *2165535520
27
+ - !ruby/object:Gem::Dependency
28
+ name: yard
29
+ requirement: &2165534260 !ruby/object:Gem::Requirement
41
30
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- segments:
46
- - 0
47
- - 6
48
- - 0
49
- version: 0.6.0
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: 0.7.2
50
35
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rspec
54
36
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
37
+ version_requirements: *2165534260
38
+ - !ruby/object:Gem::Dependency
39
+ name: rdf-spec
40
+ requirement: &2165509600 !ruby/object:Gem::Requirement
56
41
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- segments:
61
- - 2
62
- - 1
63
- - 0
64
- version: 2.1.0
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.3.4
65
46
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: rdf-spec
69
47
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
48
+ version_requirements: *2165509600
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ requirement: &2165508520 !ruby/object:Gem::Requirement
71
52
  none: false
72
- requirements:
73
- - - ~>
74
- - !ruby/object:Gem::Version
75
- segments:
76
- - 0
77
- - 3
78
- - 3
79
- version: 0.3.3
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: 2.6.0
80
57
  type: :development
81
- version_requirements: *id004
82
- description: RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data.
58
+ prerelease: false
59
+ version_requirements: *2165508520
60
+ description: RDF.rb is a pure-Ruby library for working with Resource Description Framework
61
+ (RDF) data.
83
62
  email: public-rdf-ruby@w3.org
84
- executables:
63
+ executables:
85
64
  - rdf
86
65
  extensions: []
87
-
88
66
  extra_rdoc_files: []
89
-
90
- files:
67
+ files:
91
68
  - AUTHORS
92
69
  - CREDITS
93
70
  - README
@@ -106,6 +83,7 @@ files:
106
83
  - lib/rdf/mixin/mutable.rb
107
84
  - lib/rdf/mixin/queryable.rb
108
85
  - lib/rdf/mixin/readable.rb
86
+ - lib/rdf/mixin/type_check.rb
109
87
  - lib/rdf/mixin/writable.rb
110
88
  - lib/rdf/model/graph.rb
111
89
  - lib/rdf/model/list.rb
@@ -166,39 +144,29 @@ files:
166
144
  - lib/rdf/vocab.rb
167
145
  - lib/rdf/writer.rb
168
146
  - lib/rdf.rb
169
- has_rdoc: false
170
147
  homepage: http://rdf.rubyforge.org/
171
- licenses:
148
+ licenses:
172
149
  - Public Domain
173
150
  post_install_message:
174
151
  rdoc_options: []
175
-
176
- require_paths:
152
+ require_paths:
177
153
  - lib
178
- required_ruby_version: !ruby/object:Gem::Requirement
154
+ required_ruby_version: !ruby/object:Gem::Requirement
179
155
  none: false
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- segments:
184
- - 1
185
- - 8
186
- - 1
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
187
159
  version: 1.8.1
188
- required_rubygems_version: !ruby/object:Gem::Requirement
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
161
  none: false
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- segments:
194
- - 0
195
- version: "0"
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
196
166
  requirements: []
197
-
198
167
  rubyforge_project: rdf
199
- rubygems_version: 1.3.7
168
+ rubygems_version: 1.8.10
200
169
  signing_key:
201
170
  specification_version: 3
202
171
  summary: A Ruby library for working with Resource Description Framework (RDF) data.
203
172
  test_files: []
204
-