rdf 3.0.7 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rdf/util/file.rb +9 -4
- data/lib/rdf/writer.rb +18 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42d123aacfde151f76648a3593e62fb0821441c67cf8668983becd2b1800ef41
|
4
|
+
data.tar.gz: 42ecb0370f71b7487f0255af21a8959365138da7c5791c68a3e7aaa2f7a63a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22b1e9556b6327e9e8aaaa0f244ffc04565d9c9ef7d075d14f5636672596c40fbb544d49c1bafcc11f2bf90799f85c2ae2fbfb8afbcc6148e5ee357e2d5cde22
|
7
|
+
data.tar.gz: d86ba20c17b43f887fc5609897cc24814ccf75c2bb4f0d0a8dd5a164e531e55442960e9733792aad628075b811b31f066e18182b8864bdfa0287317280417630
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.9
|
data/lib/rdf/util/file.rb
CHANGED
@@ -348,9 +348,13 @@ module RDF; module Util
|
|
348
348
|
attr_reader :content_type
|
349
349
|
|
350
350
|
# Encoding of resource (from Content-Type), downcased. Also applied to content if it is UTF
|
351
|
-
# @return [String
|
351
|
+
# @return [String]
|
352
352
|
attr_reader :charset
|
353
353
|
|
354
|
+
# Parameters from Content-Type
|
355
|
+
# @return {Symbol => String}]
|
356
|
+
attr_reader :parameters
|
357
|
+
|
354
358
|
# Response code
|
355
359
|
# @return [Integer]
|
356
360
|
attr_reader :code
|
@@ -385,8 +389,9 @@ module RDF; module Util
|
|
385
389
|
end
|
386
390
|
@headers = options.fetch(:headers, {})
|
387
391
|
@charset = options[:charset].to_s.downcase if options[:charset]
|
392
|
+
@parameters = {}
|
388
393
|
|
389
|
-
# Find Content-Type
|
394
|
+
# Find Content-Type and extract other parameters
|
390
395
|
if headers[:content_type]
|
391
396
|
ct, *params = headers[:content_type].split(';').map(&:strip)
|
392
397
|
@content_type ||= ct
|
@@ -394,8 +399,8 @@ module RDF; module Util
|
|
394
399
|
# Find charset
|
395
400
|
params.each do |param|
|
396
401
|
p, v = param.split('=')
|
397
|
-
|
398
|
-
@charset ||=
|
402
|
+
@parameters[p.downcase.to_sym] = v.sub(/^["']?([^"']*)["']?$/, '\1')
|
403
|
+
@charset ||= @parameters[p.downcase.to_sym].downcase if p.downcase == 'charset'
|
399
404
|
end
|
400
405
|
end
|
401
406
|
|
data/lib/rdf/writer.rb
CHANGED
@@ -151,6 +151,22 @@ module RDF
|
|
151
151
|
|
152
152
|
class << self
|
153
153
|
alias_method :format_class, :format
|
154
|
+
|
155
|
+
##
|
156
|
+
# Use parameters from accept-params to determine if the parameters are acceptable to invoke this writer. The `accept_params` will subsequently be provided to the writer instance.
|
157
|
+
#
|
158
|
+
# @example rejecting a writer based on a profile
|
159
|
+
# JSON::LD::Writer.accept?(profile: "http://www.w3.org/ns/json-ld#compacted http://example.org/black-listed")
|
160
|
+
# # => false
|
161
|
+
#
|
162
|
+
# @param [Hash{Symbol => String}] accept_params
|
163
|
+
# @yield [accept_params] if a block is given, returns the result of evaluating that block
|
164
|
+
# @yieldparam [Hash{Symbol => String}] accept_params
|
165
|
+
# @return [Boolean]
|
166
|
+
# @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
|
167
|
+
def accept?(accept_params)
|
168
|
+
block_given? ? yield(accept_params) : true
|
169
|
+
end
|
154
170
|
end
|
155
171
|
|
156
172
|
##
|
@@ -257,6 +273,8 @@ module RDF
|
|
257
273
|
# by all writers)
|
258
274
|
# @option options [Boolean] :unique_bnodes (false)
|
259
275
|
# Use unique {Node} identifiers, defaults to using the identifier which the node was originall initialized with (if any). Implementations should ensure that Nodes are serialized using a unique representation independent of any identifier used when creating the node. See {NTriples::Writer#format_node}
|
276
|
+
# @option options [Hash{Symbol => String}] :accept_params
|
277
|
+
# Parameters from ACCEPT header entry for the media-range matching this writer.
|
260
278
|
# @yield [writer] `self`
|
261
279
|
# @yieldparam [RDF::Writer] writer
|
262
280
|
# @yieldreturn [void]
|
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
|
+
version: 3.0.9
|
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:
|
13
|
+
date: 2019-01-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: link_header
|
@@ -297,8 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
297
|
- !ruby/object:Gem::Version
|
298
298
|
version: '0'
|
299
299
|
requirements: []
|
300
|
-
|
301
|
-
rubygems_version: 2.7.6
|
300
|
+
rubygems_version: 3.0.1
|
302
301
|
signing_key:
|
303
302
|
specification_version: 4
|
304
303
|
summary: A Ruby library for working with Resource Description Framework (RDF) data.
|