Class: Gamefic::Mud::State::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gamefic-mud/state/base.rb

Overview

An abstract class for handling client states.

Direct Known Subclasses

Guest, Play

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ Base

Returns a new instance of Base.

Parameters:



11
12
13
# File 'lib/gamefic-mud/state/base.rb', line 11

def initialize adapter
  @adapter = adapter
end

Instance Attribute Details

#adapterAdapter::Common (readonly)

Returns:



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.

Parameters:

  • message (String)


28
29
30
# File 'lib/gamefic-mud/state/base.rb', line 28

def process message
  puts "User sent #{message} in #{self.class}"
end

#startvoid

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