Class: Skiptorium::BaseDestination
- Inherits:
-
Object
- Object
- Skiptorium::BaseDestination
- Defined in:
- lib/skiptorium/base_destination.rb
Direct Known Subclasses
Skiptorium::Blogger::Destination, DevTo::Destination, GitHubPages::Destination, Hashnode::Destination, Local::Destination
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #exists?(article) ⇒ Boolean
-
#initialize(config) ⇒ BaseDestination
constructor
A new instance of BaseDestination.
- #publish(article) ⇒ Object
- #with_cache(*args, **kwargs, &block) ⇒ Object
Constructor Details
#initialize(config) ⇒ BaseDestination
Returns a new instance of BaseDestination.
10 11 12 13 |
# File 'lib/skiptorium/base_destination.rb', line 10 def initialize(config) @config = config @cache = ActiveSupport::Cache::MemoryStore.new end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
8 9 10 |
# File 'lib/skiptorium/base_destination.rb', line 8 def cache @cache end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/skiptorium/base_destination.rb', line 8 def config @config end |
Instance Method Details
#exists?(article) ⇒ Boolean
19 20 21 |
# File 'lib/skiptorium/base_destination.rb', line 19 def exists?(article) raise NotImplementedError, "#{self.class} must implement #exists?" end |
#publish(article) ⇒ Object
23 24 25 |
# File 'lib/skiptorium/base_destination.rb', line 23 def publish(article) raise NotImplementedError, "#{self.class} must implement #publish" end |
#with_cache(*args, **kwargs, &block) ⇒ Object
15 16 17 |
# File 'lib/skiptorium/base_destination.rb', line 15 def with_cache(*args, **kwargs, &block) @cache.fetch([self.class.to_s, *args], **kwargs, &block) end |