Class: SteamMist::Connectors::LazyConnector
- Inherits:
-
SteamMist::Connector
- Object
- SteamMist::Connector
- SteamMist::Connectors::LazyConnector
- Extended by:
- Forwardable
- Defined in:
- lib/steam_mist/connectors/lazy_connector.rb
Overview
Lazily loads the data from Steam, which means the request is made only when or if the data is accessed.
Instance Attribute Summary
Attributes inherited from SteamMist::Connector
#headers, #made_request, #request_uri
Instance Method Summary collapse
-
#[](name) ⇒ Object
Provides access to the data.
-
#data ⇒ Hash
This makes sure that the data was requested before it was used by checking if data is full (and if it isn’t, fill it with the data from SteamMist::Connector#force_request!).
Methods inherited from SteamMist::Connector
#cache?, #disable_caching, #each, #enable_caching, #force_request!, #initialize
Constructor Details
This class inherits a constructor from SteamMist::Connector
Instance Method Details
#[](name) ⇒ Object
Provides access to the data.
13 14 15 |
# File 'lib/steam_mist/connectors/lazy_connector.rb', line 13 def [](name) data[name] end |
#data ⇒ Hash
This makes sure that the data was requested before it was used by checking if data is full (and if it isn’t, fill it with the data from SteamMist::Connector#force_request!).
27 28 29 |
# File 'lib/steam_mist/connectors/lazy_connector.rb', line 27 def data @data ||= force_request! end |