rdf 3.0.12 → 3.0.13

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: bcde96af39c44efa90ba7eaa1b32baefef595b7047289398ef7f87feff7dbb1a
4
- data.tar.gz: d378680c75bb888ad8d079bad863309378cbd6b340061d111614d5703f17dc9b
3
+ metadata.gz: a969744cdc52b4d24c7621d70e0bdcc0cb0453ee5c9f371bc1019bacecce5b27
4
+ data.tar.gz: b2dc220b847515e8e96f1b1c55be1290b5b948e7f10ced559203d27a0793be41
5
5
  SHA512:
6
- metadata.gz: '022876050365a5ddc3f3a4e0569149583a65ba4398ed62268a4ecf7b616986fbc5662700c61d268105938fc9a3a22a7a6a73083f2a3e7e7fd7ad2fed793f9289'
7
- data.tar.gz: b7ce7cf2f38a1a75b527534162be5b0a78bf33c96c2338185186cab4fc2bbb94d63b5281396906a445b873789721a13fc89c366338763301bb5036e0e1efeeb3
6
+ metadata.gz: 28cd11713d9a680ffd9198bff24e123fba6dd489c123808704ed591931c40d1238ff37baab7bac5a9685fafc5d5168e55216b703ccd35c4bf6916853c5cd3c70
7
+ data.tar.gz: c1b11ad1585b69b65e117e5ccff21a75de10ab63aac1b5228e880fe5ea1fd380f197afdb9ed8534ed0d077477b5ca3b2a9fa6e967c2334c457d17e0620789b20
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.12
1
+ 3.0.13
data/lib/rdf.rb CHANGED
@@ -6,6 +6,9 @@ require 'time'
6
6
  require 'rdf/version'
7
7
  require 'rdf/extensions'
8
8
 
9
+ # When loading, issue deprecation warning on forthcoming unsupported versions of Ruby
10
+ warn "[DEPRECATION] Ruby 2.4+ required in next version 3.1 of RDF.rb" if RUBY_VERSION < "2.4"
11
+
9
12
  module RDF
10
13
  # RDF mixins
11
14
  autoload :Countable, 'rdf/mixin/countable'
@@ -262,7 +262,7 @@ module RDF
262
262
  description: "Validate parsed input",
263
263
  control: :none,
264
264
  parse: true,
265
- help: "validate [options] [args...]\nvalidates parsed input (may also be used with --validate)",
265
+ help: "validate [options] [args...]\nvalidates resulting repository (may also be used with --validate to check for parse-time errors)",
266
266
  lambda: ->(argv, opts) do
267
267
  opts[:output].puts "Input is " + (repository.valid? ? "" : "in") + "valid"
268
268
  end,
@@ -49,7 +49,7 @@ module RDF
49
49
  # RDF::Literal.new(123).datatype #=> XSD.integer
50
50
  # RDF::Literal.new(9223372036854775807).datatype #=> XSD.integer
51
51
  # RDF::Literal.new(3.1415).datatype #=> XSD.double
52
- # RDF::Literal.new(Time.now).datatype #=> XSD.time
52
+ # RDF::Literal.new(Time.now).datatype #=> XSD.dateTime
53
53
  # RDF::Literal.new(Date.new(2010)).datatype #=> XSD.date
54
54
  # RDF::Literal.new(DateTime.new(2010)).datatype #=> XSD.dateTime
55
55
  #
@@ -119,8 +119,8 @@ module RDF
119
119
  when ::Float then RDF::Literal::Double
120
120
  when ::BigDecimal then RDF::Literal::Decimal
121
121
  when ::DateTime then RDF::Literal::DateTime
122
+ when ::Time then RDF::Literal::DateTime
122
123
  when ::Date then RDF::Literal::Date
123
- when ::Time then RDF::Literal::Time # FIXME: Ruby's Time class can represent datetimes as well
124
124
  when ::Symbol then RDF::Literal::Token
125
125
  else self
126
126
  end
@@ -360,7 +360,7 @@ module RDF
360
360
  # @return [Boolean] `true` or `false`
361
361
  # @since 0.2.1
362
362
  def valid?
363
- return false if language? && language.to_s !~ /^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/
363
+ return false if language? && language.to_s !~ /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/
364
364
  return false if datatype? && datatype.invalid?
365
365
  grammar = self.class.const_get(:GRAMMAR) rescue nil
366
366
  grammar.nil? || value.match?(grammar)
@@ -431,7 +431,9 @@ module RDF
431
431
  joined_parts[:query] = uri.query
432
432
  else
433
433
  # Merge path segments from section 5.2.3
434
- base_path = path.to_s.sub(/\/[^\/]*$/, '/')
434
+ # Note that if the path includes no segments, the entire path is removed
435
+ # > return a string consisting of the reference's path component appended to all but the last segment of the base URI's path (i.e., excluding any characters after the right-most "/" in the base URI path, or excluding the entire base URI path if it does not contain any "/" characters).
436
+ base_path = path.to_s.include?('/') ? path.to_s.sub(/\/[^\/]*$/, '/') : ''
435
437
  joined_parts[:path] = self.class.normalize_path(base_path + uri.path)
436
438
  joined_parts[:query] = uri.query
437
439
  end
@@ -32,6 +32,7 @@ module RDF; module Util
32
32
  # @return [Hash] A hash of HTTP request headers
33
33
  def self.headers headers: {}
34
34
  headers['Accept'] ||= default_accept_header
35
+ headers['User-Agent'] ||= default_user_agent
35
36
  headers
36
37
  end
37
38
 
@@ -40,7 +41,13 @@ module RDF; module Util
40
41
  def self.default_accept_header
41
42
  (RDF::Format.accept_types + %w(*/*;q=0.1)).join(", ")
42
43
  end
43
-
44
+
45
+ ##
46
+ # @return [String] the default User-Agent used when fetching resources.
47
+ def self.default_user_agent
48
+ "Ruby RDF.rb/#{RDF::VERSION}"
49
+ end
50
+
44
51
  ##
45
52
  # @abstract
46
53
  # @param [String] base_uri to open
@@ -48,6 +55,10 @@ module RDF; module Util
48
55
  # HTTP Proxy to use for requests.
49
56
  # @param [Array, String] headers ({})
50
57
  # HTTP Request headers
58
+ #
59
+ # Defaults `Accept` header based on available reader content types to allow for content negotiation based on available readers.
60
+ #
61
+ # Defaults `User-Agent` header, unless one is specified.
51
62
  # @param [Boolean] verify_none (false)
52
63
  # Don't verify SSL certificates
53
64
  # @param [Hash{Symbol => Object}] options
@@ -249,19 +260,13 @@ module RDF; module Util
249
260
  ##
250
261
  # Open the file, returning or yielding {RemoteDocument}.
251
262
  #
252
- # Adds Accept header based on available reader content types to allow
253
- # for content negotiation based on available readers.
254
- #
255
263
  # Input received as non-unicode, is transformed to UTF-8. With Ruby >= 2.2, all UTF is normalized to [Unicode Normalization Form C (NFC)](http://unicode.org/reports/tr15/#Norm_Forms).
256
264
  #
257
265
  # HTTP resources may be retrieved via proxy using the `proxy` option. If `RestClient` is loaded, they will use the proxy globally by setting something like the following:
258
266
  # `RestClient.proxy = "http://proxy.example.com/"`.
259
267
  # When retrieving documents over HTTP(S), use the mechanism described in [Providing and Discovering URI Documentation](http://www.w3.org/2001/tag/awwsw/issue57/latest/) to pass the appropriate `base_uri` to the block or as the return.
260
268
  #
261
- # Applications needing HTTP caching may consider
262
- # [Rest Client](https://rubygems.org/gems/rest-client) and
263
- # [REST Client Components](https://rubygems.org/gems/rest-client-components)
264
- # allowing the use of `Rack::Cache` as a local file cache.
269
+ # Applications needing HTTP caching may consider [Rest Client](https://rubygems.org/gems/rest-client) and [REST Client Components](https://rubygems.org/gems/rest-client-components) allowing the use of `Rack::Cache` as a local file cache.
265
270
  #
266
271
  # @example using a local HTTP cache
267
272
  # require 'restclient/components'
@@ -275,6 +280,11 @@ module RDF; module Util
275
280
  # HTTP Proxy to use for requests.
276
281
  # @param [Array, String] headers ({})
277
282
  # HTTP Request headers
283
+ #
284
+ # Defaults `Accept` header based on available reader content types to allow for content negotiation based on available readers.
285
+ #
286
+ # Defaults `User-Agent` header, unless one is specified.
287
+ #
278
288
  # @param [Boolean] verify_none (false)
279
289
  # Don't verify SSL certificates
280
290
  # @param [Hash{Symbol => Object}] options
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.12
4
+ version: 3.0.13
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: 2019-04-17 00:00:00.000000000 Z
13
+ date: 2019-10-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: link_header
@@ -283,6 +283,10 @@ licenses:
283
283
  - Unlicense
284
284
  metadata:
285
285
  documentation_uri: https://rubydoc.info/github/ruby-rdf/rdf
286
+ bug_tracker_uri: https://github.com/ruby-rdf/rdf/issues
287
+ homepage_uri: https://ruby-rdf.github.io/rdf
288
+ mailing_list_uri: https://lists.w3.org/Archives/Public/public-rdf-ruby/
289
+ source_code_uri: https://github.com/ruby-rdf/rdf
286
290
  post_install_message:
287
291
  rdoc_options: []
288
292
  require_paths:
@@ -298,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
302
  - !ruby/object:Gem::Version
299
303
  version: '0'
300
304
  requirements: []
301
- rubygems_version: 3.0.3
305
+ rubygems_version: 3.0.4
302
306
  signing_key:
303
307
  specification_version: 4
304
308
  summary: A Ruby library for working with Resource Description Framework (RDF) data.