class Twitterscraper::Cache::Entry

Attributes

key[R]
time[R]
value[R]

Public Class Methods

from_json(text) click to toggle source
# File lib/twitterscraper/cache.rb, line 74
def from_json(text)
  json = JSON.parse(text)
  new(json['key'], Base64.decode64(json['value']), Time.parse(json['time']))
end
new(key, value, time) click to toggle source
# File lib/twitterscraper/cache.rb, line 57
def initialize(key, value, time)
  @key = key
  @value = value
  @time = time
end

Public Instance Methods

attrs() click to toggle source
# File lib/twitterscraper/cache.rb, line 63
def attrs
  {key: @key, value: @value, time: @time}
end
to_json() click to toggle source
# File lib/twitterscraper/cache.rb, line 67
def to_json
  hash = attrs
  hash[:value] = Base64.encode64(hash[:value])
  hash.to_json
end