@@ -121,7 +121,7 @@ def initialize(input, context, rename_bnodes: true, unique_bnodes: false, **opti
121121
122122 case remote_doc . document
123123 when String
124- MultiJson . load ( remote_doc . document , options )
124+ MultiJson . load ( remote_doc . document , ** options )
125125 else
126126 # Already parsed
127127 remote_doc . document
@@ -130,7 +130,7 @@ def initialize(input, context, rename_bnodes: true, unique_bnodes: false, **opti
130130
131131 # If not provided, first use context from document, or from a Link header
132132 context ||= context_ref || { }
133- @context = Context . parse ( context || { } , @options )
133+ @context = Context . parse ( context || { } , ** @options )
134134
135135 if block_given?
136136 case block . arity
@@ -164,7 +164,7 @@ def initialize(input, context, rename_bnodes: true, unique_bnodes: false, **opti
164164 # @see https://www.w3.org/TR/json-ld11-api/#expansion-algorithm
165165 def self . expand ( input , framing : false , **options , &block )
166166 result , doc_base = nil
167- API . new ( input , options [ :expandContext ] , options ) do
167+ API . new ( input , options [ :expandContext ] , ** options ) do
168168 result = self . expand ( self . value , nil , self . context ,
169169 ordered : @options [ :ordered ] ,
170170 framing : framing )
@@ -217,7 +217,7 @@ def self.compact(input, context, expanded: false, **options)
217217
218218 # 1) Perform the Expansion Algorithm on the JSON-LD input.
219219 # This removes any existing context to allow the given context to be cleanly applied.
220- expanded_input = expanded ? input : API . expand ( input , options . merge ( ordered : false ) ) do |res , base_iri |
220+ expanded_input = expanded ? input : API . expand ( input , ordered : false , ** options ) do |res , base_iri |
221221 options [ :base ] ||= base_iri if options [ :compactToRelative ]
222222 res
223223 end
@@ -264,7 +264,7 @@ def self.flatten(input, context, expanded: false, **options)
264264 } . merge ( options )
265265
266266 # Expand input to simplify processing
267- expanded_input = expanded ? input : API . expand ( input , options ) do |result , base_iri |
267+ expanded_input = expanded ? input : API . expand ( input , ** options ) do |result , base_iri |
268268 options [ :base ] ||= base_iri if options [ :compactToRelative ]
269269 result
270270 end
@@ -368,13 +368,13 @@ def self.frame(input, frame, expanded: false, **options)
368368 end
369369
370370 # Expand input to simplify processing
371- expanded_input = expanded ? input : API . expand ( input , options . merge ( ordered : false ) ) do |res , base_iri |
371+ expanded_input = expanded ? input : API . expand ( input , ordered : false , ** options ) do |res , base_iri |
372372 options [ :base ] ||= base_iri if options [ :compactToRelative ]
373373 res
374374 end
375375
376376 # Expand frame to simplify processing
377- expanded_frame = API . expand ( frame , options . merge ( framing : true , ordered : false ) )
377+ expanded_frame = API . expand ( frame , framing : true , ordered : false , ** options )
378378
379379 # Initialize input using frame as context
380380 API . new ( expanded_input , frame [ '@context' ] , no_default_base : true , **options ) do
@@ -463,7 +463,7 @@ def self.toRdf(input, expanded: false, **options, &block)
463463 unless block_given?
464464 results = [ ]
465465 results . extend ( RDF ::Enumerable )
466- self . toRdf ( input , options ) do |stmt |
466+ self . toRdf ( input , ** options ) do |stmt |
467467 results << stmt
468468 end
469469 return results
@@ -474,9 +474,9 @@ def self.toRdf(input, expanded: false, **options, &block)
474474 } . merge ( options )
475475
476476 # Expand input to simplify processing
477- expanded_input = expanded ? input : API . expand ( input , options . merge ( ordered : false ) )
477+ expanded_input = expanded ? input : API . expand ( input , ordered : false , ** options )
478478
479- API . new ( expanded_input , nil , options ) do
479+ API . new ( expanded_input , nil , ** options ) do
480480 # 1) Perform the Expansion Algorithm on the JSON-LD input.
481481 # This removes any existing context to allow the given context to be cleanly applied.
482482 log_debug ( ".toRdf" ) { "expanded input: #{ expanded_input . to_json ( JSON_STATE ) rescue 'malformed json' } " }
@@ -518,7 +518,7 @@ def self.toRdf(input, expanded: false, **options, &block)
518518 def self . fromRdf ( input , useRdfType : false , useNativeTypes : false , **options , &block )
519519 result = nil
520520
521- API . new ( nil , nil , options ) do
521+ API . new ( nil , nil , ** options ) do
522522 result = from_statements ( input ,
523523 useRdfType : useRdfType ,
524524 useNativeTypes : useNativeTypes ,
@@ -622,7 +622,7 @@ def self.loadRemoteDocument(url,
622622 end
623623 else
624624 validate_input ( remote_doc . document , url : remote_doc . documentUrl ) if validate
625- MultiJson . load ( remote_doc . document , options )
625+ MultiJson . load ( remote_doc . document , ** options )
626626 end
627627 end
628628
@@ -667,7 +667,7 @@ def self.documentLoader(url, extractAllScripts: false, profile: nil, requestProf
667667 contentType : content_type ,
668668 contextUrl : context_url ) )
669669 else
670- RDF ::Util ::File . open_file ( url , options , &block )
670+ RDF ::Util ::File . open_file ( url , ** options , &block )
671671 end
672672 end
673673
@@ -710,7 +710,7 @@ def self.load_html(input, url:,
710710 self . extend ( @implementation )
711711
712712 input = begin
713- initialize_html ( input , options )
713+ initialize_html ( input , ** options )
714714 rescue
715715 raise JSON ::LD ::JsonLdError ::LoadingDocumentFailed , "Malformed HTML document: #{ $!. message } "
716716 end
@@ -733,7 +733,7 @@ def self.load_html(input, url:,
733733 raise JSON ::LD ::JsonLdError ::InvalidScriptElement , "Script tag has type=#{ element . attributes [ 'type' ] } " unless element . attributes [ 'type' ] . to_s . start_with? ( 'application/ld+json' )
734734 content = element . inner_html
735735 validate_input ( content , url : url ) if options [ :validate ]
736- MultiJson . load ( content , options )
736+ MultiJson . load ( content , ** options )
737737 elsif extractAllScripts
738738 res = [ ]
739739 elements = if profile
@@ -747,7 +747,7 @@ def self.load_html(input, url:,
747747 elements . each do |element |
748748 content = element . inner_html
749749 validate_input ( content , url : url ) if options [ :validate ]
750- r = MultiJson . load ( content , options )
750+ r = MultiJson . load ( content , ** options )
751751 if r . is_a? ( Hash )
752752 res << r
753753 elsif r . is_a? ( Array )
@@ -761,7 +761,7 @@ def self.load_html(input, url:,
761761 element ||= input . at_xpath ( "//script[starts-with(@type, 'application/ld+json')]" )
762762 content = element ? element . inner_html : "[]"
763763 validate_input ( content , url : url ) if options [ :validate ]
764- MultiJson . load ( content , options )
764+ MultiJson . load ( content , ** options )
765765 end
766766 rescue JSON ::LD ::JsonLdError ::LoadingDocumentFailed , MultiJson ::ParseError => e
767767 raise JSON ::LD ::JsonLdError ::InvalidScriptElement , e . message
0 commit comments