Class: Jekyll::GitHubMetadata::MetadataDrop
- Inherits:
-
Drops::Drop
- Object
- Drops::Drop
- Jekyll::GitHubMetadata::MetadataDrop
- Extended by:
- Forwardable
- Defined in:
- lib/jekyll-github-metadata/metadata_drop.rb
Instance Method Summary collapse
- #build_revision ⇒ Object
- #content_methods ⇒ Object
-
#initialize(site) ⇒ MetadataDrop
constructor
A new instance of MetadataDrop.
- #keys ⇒ Object
- #to_s ⇒ Object (also: #to_str)
- #versions ⇒ Object
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_revision ⇒ Object
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_methods ⇒ Object
22 23 24 |
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 22 def content_methods super - %w(to_s to_str) end |
#keys ⇒ Object
26 27 28 |
# File 'lib/jekyll-github-metadata/metadata_drop.rb', line 26 def keys super.sort end |
#to_s ⇒ Object 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 |
#versions ⇒ Object
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 |