Class: Jekyll::GitHubMetadata::MetadataDrop

Inherits:
Drops::Drop
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/jekyll-github-metadata/metadata_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ MetadataDrop

Returns a new instance of MetadataDrop.



11
12
13
14
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 11

def initialize(site)
  @site = site
  super(nil)
end

Instance Method Details

#build_revisionObject



46
47
48
49
50
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 46

def build_revision
  @build_revision ||= begin
    ENV["JEKYLL_BUILD_REVISION"] || `git rev-parse HEAD`.strip
  end
end

#content_methodsObject



22
23
24
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 22

def content_methods
  super - %w(to_s to_str)
end

#keysObject



26
27
28
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 26

def keys
  super.sort
end

#to_sObject Also known as: to_str



16
17
18
19
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 16

def to_s
  require "json"
  JSON.pretty_generate to_h
end

#versionsObject



37
38
39
40
41
42
43
44
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 37

def versions
  @versions ||= begin
    require "github-pages"
    GitHubPages.versions
  rescue LoadError
    {}
  end
end