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



80
81
82
83
84
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 80

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

#content_methodsObject



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

def content_methods
  super - %w(to_s to_str)
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 13

def key?(key)
  return false if key.nil?
  return true if self.class.mutable? && @mutations.key?(key)
  respond_to?(key) || fallback_data.key?(key)
end

#keysObject



29
30
31
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 29

def keys
  super.sort
end

#to_sObject Also known as: to_str



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

def to_s
  require "json"
  JSON.pretty_generate to_h
end

#versionsObject



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

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