Class: RemoteResource::Lookup::Default
- Inherits:
-
Object
- Object
- RemoteResource::Lookup::Default
- Defined in:
- lib/remote_resource/lookup/default.rb
Overview
Default lookup class. Top most level class used for looking up attributes across storages and remotely over http.
Arguments:
options:
validate: 'cache_control', 'true', 'false' - Should values looked up
in storage be validated with the server. The default value
'cache_control', sets this according to the server returned
Cache-Control header. Values true and false override this.
Instance Method Summary collapse
- #find(attribute) ⇒ Object
-
#initialize(options = {}) ⇒ Default
constructor
A new instance of Default.
Constructor Details
#initialize(options = {}) ⇒ Default
Returns a new instance of Default.
17 18 19 |
# File 'lib/remote_resource/lookup/default.rb', line 17 def initialize( = {}) = .reverse_merge(validate: :cache_control) end |
Instance Method Details
#find(attribute) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/remote_resource/lookup/default.rb', line 21 def find(attribute) store_value = AttributeStorageValue.new(attribute) if store_value.data? store_value.validate if should_validate?(store_value) else store_value.fetch end store_value end |