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`



587
588
589
590
591
# File 'lib/json/ld/api.rb', line 587

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:



580
581
582
# File 'lib/json/ld/api.rb', line 580

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



576
577
578
# File 'lib/json/ld/api.rb', line 576

def document
  @document
end

#documentUrlString (readonly)

Returns URL of the loaded document, after redirects.

Returns:

  • (String)

    URL of the loaded document, after redirects



572
573
574
# File 'lib/json/ld/api.rb', line 572

def documentUrl
  @documentUrl
end