Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensure that subclasses of Reader and Writer return themselves for .fo…

…r, in spite of explicit arguments.

This corrects a problem when an explicit writer is used on a file which matches multiple Formats, to ensure that the Reader/Writer doing the call is returned.

Only when the non-subclassed Reader/Writer is used will it perform match based on options.
  • Loading branch information...
commit 9a4c53d678008156f5a658b27965f04c5072f9d6 1 parent 0443149
@gkellogg gkellogg authored
Showing with 5 additions and 3 deletions.
  1. +4 −2 lib/rdf/reader.rb
  2. +1 −1  lib/rdf/writer.rb
View
6 lib/rdf/reader.rb
@@ -55,6 +55,8 @@ def self.each(&block)
##
# Finds an RDF reader class based on the given criteria.
#
+ # If the reader class has a defined format, use that.
+ #
# @overload for(format)
# Finds an RDF reader class based on a symbolic name.
#
@@ -78,13 +80,13 @@ def self.each(&block)
#
# @return [Class]
def self.for(options = {})
- if format = Format.for(options)
+ if format = self.format || Format.for(options)
format.reader
end
end
##
- # Retrieves the RDF serialization format class for this writer class.
+ # Retrieves the RDF serialization format class for this reader class.
#
# @return [Class]
def self.format(klass = nil)
View
2  lib/rdf/writer.rb
@@ -77,7 +77,7 @@ def self.each(&block)
#
# @return [Class]
def self.for(options = {})
- if format = Format.for(options)
+ if format = self.format || Format.for(options)
format.writer
end
end

0 comments on commit 9a4c53d

Please sign in to comment.
Something went wrong with that request. Please try again.