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

Instance Method Details

#build_revisionObject



72
73
74
75
76
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 72

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

#content_methodsObject



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

def content_methods
  super - %w(to_s to_str)
end

#keysObject



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

def keys
  super.sort
end

#to_sObject Also known as: to_str



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

def to_s
  require "json"
  JSON.pretty_generate to_h
end

#versionsObject



63
64
65
66
67
68
69
70
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 63

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