class Determinator::Retrieve::InMemoryRetriever
An retriever that returns features that were previously stored in the retriever. Useful for testing.
Public Class Methods
new()
click to toggle source
# File lib/determinator/retrieve/in_memory_retriever.rb, line 7 def initialize @features = {} end
Public Instance Methods
clear!()
click to toggle source
# File lib/determinator/retrieve/in_memory_retriever.rb, line 21 def clear! @features.clear end
retrieve(name)
click to toggle source
@param name [string,symbol] The name of the feature to retrieve
# File lib/determinator/retrieve/in_memory_retriever.rb, line 12 def retrieve(name) @features.fetch(name.to_s, MissingResponse.new) end
store(feature)
click to toggle source
@param feature [Determinator::Feature] The feature to store
# File lib/determinator/retrieve/in_memory_retriever.rb, line 17 def store(feature) @features[feature.name] = feature end