Class: HTTParty::Cache::Store::Jekyll

Inherits:
Abstract
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/httparty/cache/store/jekyll.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

#clear, #delete, #getset, #key?, #marshal_dump, #marshal_load

Constructor Details

#initialize(name: self.class.name) ⇒ Jekyll

Returns a new instance of Jekyll.

Parameters:

  • :name (String)


18
19
20
21
22
# File 'lib/httparty/cache/store/jekyll.rb', line 18

def initialize(name: self.class.name)
  @options = {}
  @options[:name] = name
  @store = ::Jekyll::Cache.new(name)
end

Instance Attribute Details

#optionsHash (readonly)

Returns:

  • (Hash)


15
16
17
# File 'lib/httparty/cache/store/jekyll.rb', line 15

def options
  @options
end

Class Method Details

._load(string) ⇒ Object



28
29
30
# File 'lib/httparty/cache/store/jekyll.rb', line 28

def self._load(string)
  new(name: Marshal.load(string))
end

Instance Method Details

#_dump(_) ⇒ Object



24
25
26
# File 'lib/httparty/cache/store/jekyll.rb', line 24

def _dump(_)
  Marshal.dump(options[:name])
end

#get(key) ⇒ Object



37
38
39
40
41
# File 'lib/httparty/cache/store/jekyll.rb', line 37

def get(key)
  @store[key]
rescue RuntimeError
  nil
end

#set(key, response) ⇒ Object



32
33
34
35
# File 'lib/httparty/cache/store/jekyll.rb', line 32

def set(key, response)
  @store[key] = response
  response
end