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`



568
569
570
571
572
# File 'lib/json/ld/api.rb', line 568

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:



561
562
563
# File 'lib/json/ld/api.rb', line 561

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



557
558
559
# File 'lib/json/ld/api.rb', line 557

def document
  @document
end

#documentUrlString (readonly)

Returns URL of the loaded document, after redirects.

Returns:

  • (String)

    URL of the loaded document, after redirects



553
554
555
# File 'lib/json/ld/api.rb', line 553

def documentUrl
  @documentUrl
end