Module: Steam::Handler::Base
- Included in:
- Auth, GameCoordinator, SteamApps, SteamUser
- Defined in:
- lib/steam/handler/base.rb
Overview
Defines the base Handler
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
The Client object.
Class Method Summary collapse
-
.included(base) ⇒ Object
Inject class methods into the hosting class.
Instance Method Summary collapse
-
#handle(_packet) ⇒ Object
Handle the incoming packet.
-
#handles?(msg) ⇒ Bool
Determines if this handler can handle the given message type.
-
#initialize(client) ⇒ Object
Instantiate a Handler with a Client.
-
#send_msg(msg) ⇒ Bool
Send a message to the client.
Instance Attribute Details
#client ⇒ Object (readonly)
The Client object
24 25 26 |
# File 'lib/steam/handler/base.rb', line 24 def client @client end |
Class Method Details
.included(base) ⇒ Object
Inject class methods into the hosting class
17 18 19 |
# File 'lib/steam/handler/base.rb', line 17 def self.included(base) base.send(:extend, ClassMethods) end |
Instance Method Details
#handle(_packet) ⇒ Object
Handle the incoming packet
41 42 43 |
# File 'lib/steam/handler/base.rb', line 41 def handle(_packet) raise NotImplementedError end |
#handles?(msg) ⇒ Bool
Determines if this handler can handle the given message type. It compares the symbols given via .handles to known EMsg constants.
50 51 52 |
# File 'lib/steam/handler/base.rb', line 50 def handles?(msg) self.class..any? { |m| msg == m } end |
#initialize(client) ⇒ Object
Instantiate a Handler with a Client
34 35 36 |
# File 'lib/steam/handler/base.rb', line 34 def initialize(client) @client = client end |
#send_msg(msg) ⇒ Bool
Send a message to the client
58 59 60 |
# File 'lib/steam/handler/base.rb', line 58 def send_msg(msg) @client.send_msg(msg) end |