Class: Gamefic::Mud::State::Base
- Inherits:
-
Object
- Object
- Gamefic::Mud::State::Base
- Defined in:
- lib/gamefic-mud/state/base.rb
Overview
An abstract class for handling client states.
Instance Attribute Summary collapse
- #adapter ⇒ Adapter::Common readonly
Instance Method Summary collapse
-
#initialize(adapter) ⇒ Base
constructor
A new instance of Base.
-
#process(message) ⇒ void
Called when a message is received from a client.
-
#start ⇒ void
Called when a client’s state changes.
Constructor Details
#initialize(adapter) ⇒ Base
Returns a new instance of Base.
11 12 13 |
# File 'lib/gamefic-mud/state/base.rb', line 11 def initialize adapter @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Adapter::Common (readonly)
8 9 10 |
# File 'lib/gamefic-mud/state/base.rb', line 8 def adapter @adapter end |
Instance Method Details
#process(message) ⇒ void
This method returns an undefined value.
Called when a message is received from a client. Subclasses should implement this method.
28 29 30 |
# File 'lib/gamefic-mud/state/base.rb', line 28 def process puts "User sent #{} in #{self.class}" end |
#start ⇒ void
This method returns an undefined value.
Called when a client’s state changes. Subclasses should implement this method.
19 20 21 |
# File 'lib/gamefic-mud/state/base.rb', line 19 def start puts "User started #{self.class}" end |