Class: ROCrate::Preview

Inherits:
File show all
Defined in:
lib/ro_crate/model/preview.rb

Overview

A representation of the ‘ro-crate-preview.html` file.

Constant Summary collapse

IDENTIFIER =
'ro-crate-preview.html'.freeze
DEFAULT_TEMPLATE =
::File.expand_path(::File.join(::File.dirname(__FILE__), '..', 'ro-crate-preview.html.erb'))

Instance Attribute Summary collapse

Attributes inherited from Entity

#crate, #properties

Instance Method Summary collapse

Methods inherited from File

format_local_id, #payload, #remote?, #source

Methods inherited from DataEntity

#filepath, #payload, specialize

Methods inherited from Entity

#==, #[], #[]=, #auto_dereference, #auto_reference, #canonical_id, #delete, #dereference, #eql?, #external?, format_id, format_local_id, #has_type?, #hash, #id, #id=, #inspect, #linked_entities, properties, #raw_properties, #reference, #to_json, #type, #type=

Constructor Details

#initialize(crate, source = nil, properties = {}) ⇒ Preview

Returns a new instance of Preview.



15
16
17
18
19
# File 'lib/ro_crate/model/preview.rb', line 15

def initialize(crate, source = nil, properties = {})
  source ||= PreviewGenerator.new(self)
  @template = nil
  super(crate, source, IDENTIFIER, properties)
end

Instance Attribute Details

#templateString

The ERB template to use when rendering the preview.

Returns:

  • (String)


13
14
15
# File 'lib/ro_crate/model/preview.rb', line 13

def template
  @template
end