Class: God

Inherits:
Object
  • Object
show all
Defined in:
lib/god.rb

Instance Method Summary collapse

Instance Method Details

#accept_commandObject



51
52
53
54
# File 'lib/god.rb', line 51

def accept_command
  input
  check
end

#checkObject

The glorious check method ###



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/god.rb', line 20

def check
  case $input
    when 'inv'
      list
    when 'get'
      get
      add
    when 'n', 'north'
      $player.go(:n)
    when 's', 'south'
      $player.go(:s)
    when 'e', 'east'
      $player.go(:e)
    when 'w', 'west'
      $player.go(:w)
    when 'search'
      $player.location.search
    when 'buy'
      buy
    when 'l', 'look'
      $player.location.look
    when 'help'
      help
    when 'info'
      info
    when 'stats'
      $player.stats
    else puts 'That is not a valid command.'  
  end
end

#inputObject

The basic method of the game ###



11
12
13
14
# File 'lib/god.rb', line 11

def input
  print '>> '
  $input = gets.chomp.downcase
end

#waitObject

Defines variables ###



5
6
7
# File 'lib/god.rb', line 5

def wait
  sleep 2
end