Class: GamesAndRpgParadise::City

Inherits:
Object
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/mud/city/city.rb

Overview

< Base # === Foo::City

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ City

#

initialize

#


21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/games_and_rpg_paradise/mud/city/city.rb', line 21

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  if commandline_arguments
    @internal_hash[:name] = commandline_arguments
    if @internal_hash[:name].respond_to? :first
      @internal_hash[:name] = @internal_hash[:name].first
    end
  end
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

RpgParadise::City[]

#


83
84
85
# File 'lib/games_and_rpg_paradise/mud/city/city.rb', line 83

def self.[](i = '')
  new(i)
end

Instance Method Details

#n_people?Boolean

#

n_people?

#

Returns:

  • (Boolean)


54
55
56
# File 'lib/games_and_rpg_paradise/mud/city/city.rb', line 54

def n_people?
  @internal_hash[:n_people_can_be_found_in_this_city]
end

#name?Boolean

#

name?

#

Returns:

  • (Boolean)


61
62
63
# File 'lib/games_and_rpg_paradise/mud/city/city.rb', line 61

def name?
  @internal_hash[:name]
end

#resetObject

#

reset (reset tag)

#


38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/games_and_rpg_paradise/mud/city/city.rb', line 38

def reset
  super() if respond_to?(:super)
  @internal_hash = {}
  # ======================================================================= #
  # === :n_people_can_be_found_in_this_city
  # ======================================================================= #
  @internal_hash[:n_people_can_be_found_in_this_city] = 0
  # ======================================================================= #
  # === :name
  # ======================================================================= #
  @internal_hash[:name] = nil
end

#runObject

#

run (run tag)

#


77
78
# File 'lib/games_and_rpg_paradise/mud/city/city.rb', line 77

def run
end

#set_n_people(i) ⇒ Object

#

set_n_people

Set how many people live in this city normally.

#


70
71
72
# File 'lib/games_and_rpg_paradise/mud/city/city.rb', line 70

def set_n_people(i)
  @internal_hash[:n_people_can_be_found_in_this_city] = i
end