Class: Alchemist::Commands::DirectionCommand

Inherits:
Base
  • Object
show all
Defined in:
lib/alchemist-server/commands/directions.rb

Direct Known Subclasses

East, North, South, West

Instance Attribute Summary

Attributes inherited from Base

#avatar_name, #history

Instance Method Summary collapse

Methods inherited from Base

#initialize, #outcome, pattern, run

Constructor Details

This class inherits a constructor from Alchemist::Commands::Base

Instance Method Details

#runObject



4
5
6
7
8
9
10
11
# File 'lib/alchemist-server/commands/directions.rb', line 4

def run
  world = history.world.move avatar_name, direction
  x, y = world.location avatar_name

  outcome "location #{x} #{y}",
          world,
          Commands::Who
end