Class: JekyllRecker::Social::Share Abstract
- Inherits:
-
Object
- Object
- JekyllRecker::Social::Share
- Includes:
- Logging
- Defined in:
- lib/jekyll_recker/social.rb
Overview
This class is abstract.
Backend
Backend base class for social sharing backends.
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #config_key ⇒ Object (also: #name)
- #configure! ⇒ Object
- #dry? ⇒ Boolean
-
#initialize(site, dry: false) ⇒ Share
constructor
A new instance of Share.
- #latest ⇒ Object
- #latest_title ⇒ Object
- #post! ⇒ Object
- #post_body ⇒ Object
Methods included from Logging
Constructor Details
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
22 23 24 |
# File 'lib/jekyll_recker/social.rb', line 22 def site @site end |
Class Method Details
.share(site, dry: false) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/jekyll_recker/social.rb', line 24 def self.share(site, dry: false) backend = new(site, dry: dry) info "#{backend.name} - building configuration" backend.configure! info "#{backend.name} - sharing \"#{backend.latest_title}\"" backend.post! end |
Instance Method Details
#config ⇒ Object
42 43 44 |
# File 'lib/jekyll_recker/social.rb', line 42 def config site.recker_config.fetch(config_key, {}) end |
#config_key ⇒ Object Also known as: name
46 47 48 |
# File 'lib/jekyll_recker/social.rb', line 46 def config_key self.class.const_get(:KEY) end |
#configure! ⇒ Object
67 68 69 |
# File 'lib/jekyll_recker/social.rb', line 67 def configure! raise NotImplementedError end |
#dry? ⇒ Boolean
38 39 40 |
# File 'lib/jekyll_recker/social.rb', line 38 def dry? @dry end |
#latest ⇒ Object
63 64 65 |
# File 'lib/jekyll_recker/social.rb', line 63 def latest site.latest end |
#latest_title ⇒ Object
59 60 61 |
# File 'lib/jekyll_recker/social.rb', line 59 def latest_title latest.title end |
#post! ⇒ Object
71 72 73 |
# File 'lib/jekyll_recker/social.rb', line 71 def post! raise NotImplementedError end |
#post_body ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/jekyll_recker/social.rb', line 51 def post_body <<~BODY #{latest.title} #{latest.subtitle} #{File.join site.url, latest.url} BODY end |