lib/ld/patch.rb in ld-patch-0.3.3 vs lib/ld/patch.rb in ld-patch-3.1.0
- old
+ new
@@ -26,12 +26,12 @@
# @param [Hash{Symbol => Object}] options
# @option options [#to_s] :base_uri (nil)
# the base URI to use when resolving relative URIs
# @option (see LD::Patch::Parser#initialize)
# @return [SPARQL::Algebra::Operator] The executable parsed Patch
- def self.parse(input, options = {})
- LD::Patch::Parser.new(input, options).parse
+ def self.parse(input, **options)
+ LD::Patch::Parser.new(input, **options).parse
end
class Error < StandardError
# The status code associated with this error
attr_reader :code
@@ -40,11 +40,11 @@
# Initializes a new patch error instance.
#
# @param [String, #to_s] message
# @param [Hash{Symbol => Object}] options
# @option options [Integer] :code (422)
- def initialize(message, options = {})
+ def initialize(message, **options)
@code = options.fetch(:status_code, 422)
super(message.to_s)
end
end
@@ -68,10 +68,10 @@
# @param [String, #to_s] message
# @param [Hash{Symbol => Object}] options
# @option options [String] :token (nil)
# @option options [Integer] :lineno (nil)
# @option options [Integer] :code (400)
- def initialize(message, options = {})
+ def initialize(message, **options)
@token = options[:token]
@lineno = options[:lineno] || (@token.lineno if @token.respond_to?(:lineno))
super(message.to_s, code: options.fetch(:code, 400))
end
end