Class: Jekyll::ActivityPub::Image

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/jekyll/activity_pub/image.rb

Overview

Represents an Image

Direct Known Subclasses

Document

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#content, #generate_excerpt?, #hook_owner, #locale, #place_in_layout?, #pruned_data, #render_with_liquid?, #to_json, #to_liquid, #trigger_hooks

Constructor Details

#initialize(site, path, description = nil) ⇒ Image

Initialize with default data

Parameters:

  • :site (Jekyll::Site)
  • :path (Path)
  • :description (String)


20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/jekyll/activity_pub/image.rb', line 20

def initialize(site, path, description = nil)
  @context = StubContext.new(registers: { site: site })

  @data = {
    'type' => 'Image',
    'mediaType' => Marcel::MimeType.for(Pathname.new(site.in_source_dir(path))),
    'url' => absolute_url(path),
    'name' => description.to_s
  }

  trigger_hooks :post_init
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



13
14
15
# File 'lib/jekyll/activity_pub/image.rb', line 13

def data
  @data
end