Class: Apollo::Instance
- Inherits:
-
Object
- Object
- Apollo::Instance
- Defined in:
- lib/apollo/instance.rb
Overview
A copy of Apollo’s base module class methods.
Instance Attribute Summary collapse
- #client ⇒ Object
-
#configuration ⇒ Object
See Apollo::Configuration.
Instance Method Summary collapse
- #configure {|configuration| ... } ⇒ Object
- #fetch(key, opts = {}) ⇒ Object
-
#initialize(config = nil) ⇒ Instance
constructor
A new instance of Instance.
Constructor Details
#initialize(config = nil) ⇒ Instance
Returns a new instance of Instance.
10 11 12 |
# File 'lib/apollo/instance.rb', line 10 def initialize(config = nil) self.configuration = config || Configuration.new end |
Instance Attribute Details
#client ⇒ Object
14 15 16 |
# File 'lib/apollo/instance.rb', line 14 def client @client ||= Client.new(configuration) end |
#configuration ⇒ Object
See Apollo::Configuration
8 9 10 |
# File 'lib/apollo/instance.rb', line 8 def configuration @configuration end |
Instance Method Details
#configure {|configuration| ... } ⇒ Object
18 19 20 21 22 |
# File 'lib/apollo/instance.rb', line 18 def configure yield(configuration) if block_given? self.client = Client.new(configuration) client end |
#fetch(key, opts = {}) ⇒ Object
24 25 26 27 |
# File 'lib/apollo/instance.rb', line 24 def fetch(key, opts = {}) opts[:disable_cache] = false unless opts.key?(:disable_cache) client.fetch(key, opts[:disable_cache]) end |