rdf 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 932836f4b2fae338cfabd3acc588c98b035868f4d8ec5a1d92fbd035ef25f23f
4
- data.tar.gz: 7b173b18ff4586198f5554083d12df3147d3a1f1cb363078ee0d3e92dcb6b9aa
3
+ metadata.gz: 3bea45795551315414671bb114872e5cac5162e1ec2a27e05a9d4879120ab134
4
+ data.tar.gz: a992b86dca4f494960654e4fc9435d7ed2ebaae59a4dd51c73c98213c36f8468
5
5
  SHA512:
6
- metadata.gz: f7833c0a0177907b32702d1ccf8b34b26e0f3c78525f46b35277995e7bb377e1bbe7cf28d01a189d42ae29515c58e7b80ab70e2068fc6d9eb379460e15ab0496
7
- data.tar.gz: 5afb152c0526dc5efd5784a2e2496f52f1668bef49ba942885981cfefe1c485326f68c76456bb2c13720c396454558218a4fbe6585372c36a2a7c3cbfc9f2540
6
+ metadata.gz: 827ef18bb7e6f5f299ce5ba7e570012e03a391b1b025a915b2ea0d3faa9bb42446393dddb41d015dade8889395c11b7413c9134af14d88c28c8caa15eca0c3c7
7
+ data.tar.gz: 9c2109b329d2ea4e5417c4c86f026c49a039055a2151ba24963f920b70a6dfbf64417088fda6477aa5ce849bb692de1962f1dd9cdf6287c913623d966bffc26f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.4
1
+ 3.0.5
@@ -534,7 +534,7 @@ module RDF
534
534
  term_defs.each do |term, attributes|
535
535
  # Turn embedded BNodes into either their Term definition or a List
536
536
  attributes.each do |ak, avs|
537
- attributes[ak] = avs.is_a?(Array) ? avs.map do |av|
537
+ attributes[ak] = avs.is_a?(Array) ? (avs.map do |av|
538
538
  l = RDF::List.new(subject: av, graph: graph)
539
539
  if l.valid?
540
540
  RDF::List.new(subject: av) do |nl|
@@ -547,7 +547,7 @@ module RDF
547
547
  else
548
548
  av
549
549
  end
550
- end.compact : avs
550
+ end).compact : avs
551
551
  end
552
552
 
553
553
  if term == :""
@@ -158,29 +158,22 @@ module RDF
158
158
  # the graph or repository to dump
159
159
  # @param [IO, File, String] io
160
160
  # the output stream or file to write to
161
- # @param [Encoding, String, Symbol] encoding
162
- # the encoding to use on the output stream.
163
- # Defaults to the format associated with `content_encoding`.
164
161
  # @param [Hash{Symbol => Object}] options
165
162
  # passed to {RDF::Writer#initialize} or {RDF::Writer.buffer}
166
163
  # @return [void]
167
- def self.dump(data, io = nil, encoding: nil, **options)
168
- if io.is_a?(String)
169
- io = File.open(io, 'w')
170
- elsif io.respond_to?(:external_encoding) && io.external_encoding
171
- encoding ||= io.external_encoding
172
- end
173
- io.set_encoding(encoding) if io.respond_to?(:set_encoding) && encoding
164
+ def self.dump(data, io = nil, **options)
165
+ io = File.open(io, 'w') if io.is_a?(String)
174
166
  method = data.respond_to?(:each_statement) ? :each_statement : :each
175
167
  if io
176
- new(io, encoding: encoding, **options) do |writer|
168
+ new(io, **options) do |writer|
169
+ io.set_encoding(writer.encoding) if io.respond_to?(:set_encoding)
177
170
  data.send(method) do |statement|
178
171
  writer << statement
179
172
  end
180
173
  writer.flush
181
174
  end
182
175
  else
183
- buffer(encoding: encoding, **options) do |writer|
176
+ buffer(**options) do |writer|
184
177
  data.send(method) do |statement|
185
178
  writer << statement
186
179
  end
@@ -191,9 +184,6 @@ module RDF
191
184
  ##
192
185
  # Buffers output into a string buffer.
193
186
  #
194
- # @param [Encoding, String, Symbol] encoding
195
- # the encoding to use on the output stream.
196
- # Defaults to the format associated with `content_encoding`.
197
187
  # @param [Hash{Symbol => Object}] options
198
188
  # passed to {RDF::Writer#initialize}
199
189
  # @yield [writer]
@@ -201,13 +191,14 @@ module RDF
201
191
  # @yieldreturn [void]
202
192
  # @return [String]
203
193
  # @raise [ArgumentError] if no block is provided
204
- def self.buffer(*args, encoding: nil, **options, &block)
205
- encoding ||= Encoding::UTF_8 if RUBY_PLATFORM == "java"
194
+ def self.buffer(*args, **options, &block)
206
195
  raise ArgumentError, "block expected" unless block_given?
207
196
 
208
197
  StringIO.open do |buffer|
209
- buffer.set_encoding(encoding) if encoding
210
- self.new(buffer, *args, encoding: encoding, **options) { |writer| block.call(writer) }
198
+ self.new(buffer, *args, **options) do |writer|
199
+ buffer.set_encoding(writer.encoding)
200
+ block.call(writer)
201
+ end
211
202
  buffer.string
212
203
  end
213
204
  end
@@ -216,19 +207,18 @@ module RDF
216
207
  # Writes output to the given `filename`.
217
208
  #
218
209
  # @param [String, #to_s] filename
219
- # @param [Encoding, String, Symbol] encoding
220
- # the encoding to use on the output stream.
221
- # Defaults to the format associated with `content_encoding`.
222
210
  # @param [Symbol] format (nil)
223
211
  # @param [Hash{Symbol => Object}] options
224
212
  # any additional options (see {RDF::Writer#initialize} and {RDF::Format.for})
225
213
  # @return [RDF::Writer]
226
- def self.open(filename, encoding: nil, format: nil, **options, &block)
214
+ def self.open(filename, format: nil, **options, &block)
227
215
  File.open(filename, 'wb') do |file|
228
- file.set_encoding(encoding) if encoding
229
216
  format_options = options.dup
230
217
  format_options[:file_name] ||= filename
231
- self.for(format || format_options).new(file, encoding: encoding, **options, &block)
218
+ self.for(format || format_options).new(file, **options) do |writer|
219
+ file.set_encoding(writer.encoding)
220
+ block.call(writer)
221
+ end
232
222
  end
233
223
  end
234
224
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-09-20 00:00:00.000000000 Z
13
+ date: 2018-10-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: link_header
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  version: '0'
299
299
  requirements: []
300
300
  rubyforge_project:
301
- rubygems_version: 2.7.6
301
+ rubygems_version: 2.7.7
302
302
  signing_key:
303
303
  specification_version: 4
304
304
  summary: A Ruby library for working with Resource Description Framework (RDF) data.