Class: Jekyll::ActivityPub::Nodeinfo20
- Inherits:
-
Page
- Object
- Page
- Jekyll::ActivityPub::Nodeinfo20
- Includes:
- Helper
- Defined in:
- lib/jekyll/activity_pub/nodeinfo_20.rb
Overview
Points to site’s nodeinfo 2.0
Direct Known Subclasses
Instance Method Summary collapse
- #increase_local_posts_counter! ⇒ nil
-
#initialize(site, base = '', dir = 'nodeinfo', name = version) ⇒ Nodeinfo20
constructor
Initialize with default data.
-
#permalink ⇒ String
The nodeinfo file is expected to be at this location always.
- #read_yaml ⇒ Object
- #to_jrd ⇒ Hash
- #version ⇒ Object
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, base = '', dir = 'nodeinfo', name = version) ⇒ Nodeinfo20
Initialize with default data
23 24 25 26 27 28 29 |
# File 'lib/jekyll/activity_pub/nodeinfo_20.rb', line 23 def initialize(site, base = '', dir = 'nodeinfo', name = version) @context = StubContext.new(registers: { site: site }) super(site, base, dir, name) trigger_hooks :post_init end |
Instance Method Details
#increase_local_posts_counter! ⇒ nil
70 71 72 73 |
# File 'lib/jekyll/activity_pub/nodeinfo_20.rb', line 70 def increase_local_posts_counter! data['usage']['localPosts'] += 1 nil end |
#permalink ⇒ String
The nodeinfo file is expected to be at this location always
57 58 59 |
# File 'lib/jekyll/activity_pub/nodeinfo_20.rb', line 57 def permalink "nodeinfo/#{version}.json" end |
#read_yaml ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/jekyll/activity_pub/nodeinfo_20.rb', line 31 def read_yaml(*) self.data = { 'version' => version, 'software' => { 'name' => 'sutty-distributed-press', 'version' => Jekyll::ActivityPub::VERSION }, 'protocols' => ['activitypub'], 'services' => {}, 'openRegistrations' => false, 'usage' => { 'users' => { 'total' => 1, 'activeHalfyear' => 1, 'activeMonth' => 1 }, 'localPosts' => 0, 'localComments' => 0 }, 'metadata' => {} } end |
#to_jrd ⇒ Hash
62 63 64 65 66 67 |
# File 'lib/jekyll/activity_pub/nodeinfo_20.rb', line 62 def to_jrd { 'rel' => "http://nodeinfo.diaspora.software/ns/schema/#{version}", 'href' => absolute_url(url) } end |
#version ⇒ Object
13 14 15 |
# File 'lib/jekyll/activity_pub/nodeinfo_20.rb', line 13 def version '2.0' end |