Class: SteamMist::Connectors::LazyConnector

Inherits:
SteamMist::Connector show all
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

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.

Returns:

  • (Object)


13
14
15
# File 'lib/steam_mist/connectors/lazy_connector.rb', line 13

def [](name)
  data[name]
end

#dataHash

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!).

Returns:

  • (Hash)

    the data.



27
28
29
# File 'lib/steam_mist/connectors/lazy_connector.rb', line 27

def data
	@data ||= force_request!
end