lib/rdf/turtle/reader.rb in rdf-turtle-3.0.6 vs lib/rdf/turtle/reader.rb in rdf-turtle-3.1.0
- old
+ new
@@ -46,18 +46,18 @@
##
# Redirect for Freebase Reader
#
# @private
- def self.new(input = nil, options = {}, &block)
+ def self.new(input = nil, **options, &block)
klass = if options[:freebase]
FreebaseReader
else
self
end
reader = klass.allocate
- reader.send(:initialize, input, options, &block)
+ reader.send(:initialize, input, **options, &block)
reader
end
##
# Initializes a new reader instance.
@@ -80,11 +80,11 @@
# @option options [Logger, #write, #<<] :logger
# Record error/info/debug output
# @option options [Boolean] :freebase (false)
# Use optimized Freebase reader
# @return [RDF::Turtle::Reader]
- def initialize(input = nil, options = {}, &block)
+ def initialize(input = nil, **options, &block)
super do
@options = {
anon_base: "b0",
whitespace: WS,
log_depth: 0,
@@ -96,11 +96,11 @@
log_debug("validate") {validate?.inspect}
log_debug("canonicalize") {canonicalize?.inspect}
log_debug("intern") {intern?.inspect}
- @lexer = EBNF::LL1::Lexer.new(input, self.class.patterns, @options)
+ @lexer = EBNF::LL1::Lexer.new(input, self.class.patterns, **@options)
if block_given?
case block.arity
when 0 then instance_eval(&block)
else block.call(self)
@@ -182,18 +182,18 @@
rescue ArgumentError => e
error("process_iri", e)
end
# Create a literal
- def literal(value, options = {})
+ def literal(value, **options)
log_debug("literal") do
"value: #{value.inspect}, " +
"options: #{options.inspect}, " +
"validate: #{validate?.inspect}, " +
"c14n?: #{canonicalize?.inspect}"
end
- RDF::Literal.new(value, options.merge(validate: validate?, canonicalize: canonicalize?))
+ RDF::Literal.new(value, validate: validate?, canonicalize: canonicalize?, **options)
rescue ArgumentError => e
error("Argument Error #{e.message}", production: :literal, token: @lexer.first)
end
##
@@ -585,10 +585,10 @@
# @param [String, #to_s] message
# @param [Hash{Symbol => Object}] options
# @option options [Symbol] :production (nil)
# @option options [String] :token (nil)
# @option options [Integer] :lineno (nil)
- def initialize(message, options = {})
+ def initialize(message, **options)
@production = options[:production]
@token = options[:token]
@lineno = options[:lineno] || (@token.lineno if @token.respond_to?(:lineno))
super(message.to_s)
end