Class: TimedCache::Value

Inherits:
Struct
  • Object
show all
Defined in:
lib/tins/timed_cache.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#timestampObject

Returns the value of attribute timestamp

Returns:

  • (Object)

    the current value of timestamp



2
3
4
# File 'lib/tins/timed_cache.rb', line 2

def timestamp
  @timestamp
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



2
3
4
# File 'lib/tins/timed_cache.rb', line 2

def value
  @value
end

Class Method Details

.json_create(hash) ⇒ Object



3
4
5
# File 'lib/tins/timed_cache.rb', line 3

def self.json_create(hash)
  new(*hash.values_at('value', 'timestamp'))
end

Instance Method Details

#as_jsonObject



7
8
9
# File 'lib/tins/timed_cache.rb', line 7

def as_json(*)
  super | { JSON.create_id => self.class.name }
end