rdf 1.1.0.1 → 1.1.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
  SHA1:
3
- metadata.gz: 08c8571664914321e0f474aee4a4f81b0e303bf4
4
- data.tar.gz: 1dcccdce4b1396acab2adcb0d65d8d650e6a89c5
3
+ metadata.gz: 103746563b943a055874ff834ecb5dfc5f2799af
4
+ data.tar.gz: 2041f3080c55e3d276912dd02572642f796687c7
5
5
  SHA512:
6
- metadata.gz: 26f678c74a88cb7aaf3ad2b964005f5362937b8b130ca5200dd8860b125d02aef3a49cb275fe318600ac7bcffb8a1ee45d53fc7b6901a735aa4d592ca6fa60f5
7
- data.tar.gz: cdf1ad2fbf9cf7f61aaac9e6e684768ef81fdcf0960697e9105b10218713878dd514bc63f1de8be1ade63e7107448219def7fd2309188d3123d48359f05e4506
6
+ metadata.gz: c144b4120b8762714fd9aed3a832378238bf3fcb70067f3a5d236ad9e2e3ed3343ef12a9841ff8774d9b3e23fddf924ce49168cecdf5fae8e40e73fcc9634365
7
+ data.tar.gz: 76a75cb6ea42718f3eac37080c7aebf46ab5d256330d7650a61f38b5464175e70a06307bad4db100f56258f8188c3ce369d877df43bfc99e528c08a1e7eacfe8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0.1
1
+ 1.1.1
data/lib/rdf/nquads.rb CHANGED
@@ -83,7 +83,7 @@ module RDF
83
83
  object = read_uriref || read_node || read_literal || fail_object
84
84
  context = read_uriref || read_node
85
85
  if validate? && !read_eos
86
- raise RDF::ReaderError, "expected end of statement in line #{lineno}: #{current_line.inspect}"
86
+ raise RDF::ReaderError.new("ERROR [line #{lineno}] Expected end of statement (found: #{current_line.inspect})")
87
87
  end
88
88
  return [subject, predicate, object, {:context => context}]
89
89
  end
@@ -212,7 +212,8 @@ module RDF::NTriples
212
212
  object = read_uriref || read_node || read_literal || fail_object
213
213
 
214
214
  if validate? && !read_eos
215
- raise RDF::ReaderError, "expected end of statement in line #{lineno}: #{current_line.inspect}"
215
+ raise RDF::ReaderError.new("ERROR [line #{lineno}] Expected end of statement (found: #{current_line.inspect})",
216
+ lineno: lineno)
216
217
  end
217
218
  return [subject, predicate, object]
218
219
  end
@@ -238,12 +239,11 @@ module RDF::NTriples
238
239
  uri_str = self.class.unescape(uri_str)
239
240
  uri = RDF::URI.send(intern? && options[:intern] ? :intern : :new, uri_str)
240
241
  uri.validate! if validate?
241
- raise RDF::ReaderError, "uri not absolute" if validate? && !uri.absolute?
242
242
  uri.canonicalize! if canonicalize?
243
243
  uri
244
244
  end
245
245
  rescue ArgumentError => e
246
- raise RDF::ReaderError, "invalid URI"
246
+ raise RDF::ReaderError.new("ERROR [line #{lineno}] Invalid URI (found: \"<#{uri_str}>\")", lineno: lineno, token: "<#{uri_str}>")
247
247
  end
248
248
 
249
249
  ##
data/lib/rdf/reader.rb CHANGED
@@ -398,7 +398,8 @@ module RDF
398
398
  # @return [void]
399
399
  # @raise [RDF::ReaderError]
400
400
  def fail_subject
401
- raise RDF::ReaderError, "expected subject in line #{lineno}: #{current_line.inspect}"
401
+ raise RDF::ReaderError.new("ERROR [line #{lineno}] Expected subject (found: #{current_line.inspect})",
402
+ lineno: lineno)
402
403
  end
403
404
 
404
405
  ##
@@ -407,7 +408,8 @@ module RDF
407
408
  # @return [void]
408
409
  # @raise [RDF::ReaderError]
409
410
  def fail_predicate
410
- raise RDF::ReaderError, "expected predicate in line #{lineno}: #{current_line.inspect}"
411
+ raise RDF::ReaderError.new("ERROR [line #{lineno}] Expected predicate (found: #{current_line.inspect})",
412
+ lineno: lineno)
411
413
  end
412
414
 
413
415
  ##
@@ -416,7 +418,8 @@ module RDF
416
418
  # @return [void]
417
419
  # @raise [RDF::ReaderError]
418
420
  def fail_object
419
- raise RDF::ReaderError, "expected object in line #{lineno}: #{current_line.inspect}"
421
+ raise RDF::ReaderError.new("ERROR [line #{lineno}] Expected object (found: #{current_line.inspect})",
422
+ lineno: lineno)
420
423
  end
421
424
 
422
425
  ##
@@ -526,5 +529,29 @@ module RDF
526
529
  ##
527
530
  # The base class for RDF parsing errors.
528
531
  class ReaderError < IOError
532
+ ##
533
+ # The invalid token which triggered the error.
534
+ #
535
+ # @return [String]
536
+ attr_reader :token
537
+
538
+ ##
539
+ # The line number where the error occurred.
540
+ #
541
+ # @return [Integer]
542
+ attr_reader :lineno
543
+
544
+ ##
545
+ # Initializes a new lexer error instance.
546
+ #
547
+ # @param [String, #to_s] message
548
+ # @param [Hash{Symbol => Object}] options
549
+ # @option options [String] :token (nil)
550
+ # @option options [Integer] :lineno (nil)
551
+ def initialize(message, options = {})
552
+ @token = options[:token]
553
+ @lineno = options[:lineno] || (@token.lineno if @token.respond_to?(:lineno))
554
+ super(message.to_s)
555
+ end
529
556
  end # ReaderError
530
557
  end # RDF
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: 1.1.0.1
4
+ version: 1.1.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: 2013-12-11 00:00:00.000000000 Z
13
+ date: 2013-12-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf-spec