Class: Skiptorium::BaseDestination

Inherits:
Object
  • Object
show all
Defined in:
lib/skiptorium/base_destination.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cacheObject (readonly)

Returns the value of attribute cache.



8
9
10
# File 'lib/skiptorium/base_destination.rb', line 8

def cache
  @cache
end

#configObject (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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


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