Class: SteamMist::Session
- Inherits:
-
Object
- Object
- SteamMist::Session
- Defined in:
- lib/steam_mist/session.rb
Overview
The session is used as a starting point for connecting to the Steam API.
Instance Attribute Summary collapse
-
#connector ⇒ Class
The connector that the session is going to use.
-
#default_arguments ⇒ Hash
The default arguments that the session will use.
Instance Method Summary collapse
-
#get_interface(interface) ⇒ PseudoInterface
Grabs an interface for use.
-
#initialize(connector = Connectors::LazyConnector) ⇒ Session
constructor
Initialize.
-
#inspect ⇒ Object
pretty inspection.
-
#method_missing(method, *args) ⇒ Object
Some #method_missing magic.
Constructor Details
#initialize(connector = Connectors::LazyConnector) ⇒ Session
Initialize.
31 32 33 34 35 |
# File 'lib/steam_mist/session.rb', line 31 def initialize(connector = Connectors::LazyConnector) @connector = connector @_interfaces = {} @default_arguments = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
Some #method_missing magic. Sorry @charliesome!
49 50 51 52 |
# File 'lib/steam_mist/session.rb', line 49 def method_missing(method, *args) super if args.length > 0 or block_given? get_interface method end |
Instance Attribute Details
#connector ⇒ Class
The connector that the session is going to use.
21 22 23 |
# File 'lib/steam_mist/session.rb', line 21 def connector @connector end |
#default_arguments ⇒ Hash
The default arguments that the session will use.
26 27 28 |
# File 'lib/steam_mist/session.rb', line 26 def default_arguments @default_arguments end |
Instance Method Details
#get_interface(interface) ⇒ PseudoInterface
Grabs an interface for use. These are cached, so every call with the same argument returns the same object.
42 43 44 |
# File 'lib/steam_mist/session.rb', line 42 def get_interface(interface) @_interfaces[interface] ||= PseudoInterface.new(self, interface) end |
#inspect ⇒ Object
pretty inspection
55 56 57 |
# File 'lib/steam_mist/session.rb', line 55 def inspect "#<SteamMist::Session #{connector.inspect}>" end |