rdf 3.0.0 → 3.0.1

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: faf85190255c4c7a4d081a70108143f0aa084c62fbb75b9a61bd063d75d1b324
4
- data.tar.gz: f851e574e23e8a795a008e150827a24e3daab79c79abb26a84b29cc768060810
3
+ metadata.gz: ebe49e2d90f8231d8595f66232f97b167fa0e4f90edbeb1112536c968d5b0598
4
+ data.tar.gz: 2d14168594558213b9c6f855e8a3407287f2a9a9d913ec2e8ae4b98aa0c7b8ac
5
5
  SHA512:
6
- metadata.gz: fd23a8bb42a9f9a0eabf5d378c9ef128917c96a4b8030738c60ef2babc0edc049d16118692d0825cb8058d70da1909df0bbe202b020881eca01eb8b387a19a07
7
- data.tar.gz: 7972ad893f01703c35ea71f6fa7962fd2552359e79aeb317511da52c0a91b5e459573a6a729b3477653e62ac7360a6f539945fa9a18abb37c8afc43c61283ade
6
+ metadata.gz: 470a83b9eb6412b8b52517c7fd12f327e4b8983d1410e95556d3a67e170cd1f4d25e72e0489d329dec73986f224488cd6717e014cec73d6a8ab37c41643ef971
7
+ data.tar.gz: b5e022cd1cfdb6c9aa4b9075fecf5447bdef0d8c39318d68f5242840a3e53b71bd3a06d427f08f74ae4cb94ac8448951e757251386fc0dfc0bdf29124b8b3c1a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.0.1
@@ -65,6 +65,8 @@ module RDF
65
65
  # Only return a format having a writer.
66
66
  # @param [String, Proc] sample (nil)
67
67
  # A sample of input used for performing format detection. If we find no formats, or we find more than one, and we have a sample, we can perform format detection to find a specific format to use, in which case we pick the last one we find
68
+ # @param [Boolean] all_if_none (true)
69
+ # Returns all formats if none match, otherwise no format. Note that having a `sample` overrides this, and will search through all formats, or all those filtered to find a sample that matches
68
70
  # @yield [klass]
69
71
  # @yieldparam [Class]
70
72
  # @return [Enumerator]
@@ -74,6 +76,7 @@ module RDF
74
76
  has_reader: false,
75
77
  has_writer: false,
76
78
  sample: nil,
79
+ all_if_none: true,
77
80
  **options,
78
81
  &block)
79
82
  formats = case
@@ -106,7 +109,7 @@ module RDF
106
109
  when file_extension
107
110
  file_extensions[file_extension.to_sym]
108
111
  else
109
- @@subclasses
112
+ all_if_none ? @@subclasses : nil
110
113
  end || (sample ? @@subclasses : []) # If we can sample, check all classes
111
114
 
112
115
  # Subset by available reader or writer
@@ -181,7 +184,7 @@ module RDF
181
184
  end
182
185
  classes
183
186
  else
184
- self.each(options).to_a
187
+ self.each(options.merge(all_if_none: false)).to_a
185
188
  end
186
189
 
187
190
  # Return the last detected format
@@ -304,9 +304,11 @@ module RDF
304
304
  # @param [RDF::URI] uri
305
305
  # @return [Vocabulary]
306
306
  def find(uri)
307
+ uri = RDF::URI(uri) if uri.is_a?(String)
308
+ return nil unless uri.uri? && uri.valid?
307
309
  RDF::Vocabulary.detect do |v|
308
310
  if uri.length >= v.to_uri.length
309
- RDF::URI(uri).start_with?(v.to_uri)
311
+ uri.start_with?(v.to_uri)
310
312
  else
311
313
  v.to_uri.to_s.sub(%r([/#]$), '') == uri.to_s
312
314
  end
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.0
4
+ version: 3.0.1
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: 2017-12-17 00:00:00.000000000 Z
13
+ date: 2017-12-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: link_header