Class: JSON::LD::API::RemoteDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/json/ld/api.rb

Overview

A RemoteDocument is returned from a documentLoader.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, document, context_url = nil) ⇒ RemoteDocument

Returns a new instance of RemoteDocument.

Parameters:

  • url (String)

    URL of the loaded document, after redirects

  • document (String, Array<Hash>, Hash)

    The retrieved document, either as raw text or parsed JSON

  • context_url (String) (defaults to: nil)

    (nil) The URL of a remote context as specified by an HTTP Link header with rel=‘www.w3.org/ns/json-ld#context`



547
548
549
550
551
# File 'lib/json/ld/api.rb', line 547

def initialize(url, document, context_url = nil)
  @documentUrl = url
  @document = document
  @contextUrl = context_url
end

Instance Attribute Details

#contextUrlString

Returns The URL of a remote context as specified by an HTTP Link header with rel=‘www.w3.org/ns/json-ld#context`.

Returns:



540
541
542
# File 'lib/json/ld/api.rb', line 540

def contextUrl
  @contextUrl
end

#documentString, ... (readonly)

Returns The retrieved document, either as raw text or parsed JSON.

Returns:

  • (String, Array<Hash>, Hash)

    The retrieved document, either as raw text or parsed JSON



536
537
538
# File 'lib/json/ld/api.rb', line 536

def document
  @document
end

#documentUrlString (readonly)

Returns URL of the loaded document, after redirects.

Returns:

  • (String)

    URL of the loaded document, after redirects



532
533
534
# File 'lib/json/ld/api.rb', line 532

def documentUrl
  @documentUrl
end