Class: GamesAndRpgParadise::Mud::Settlements::Towns::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb

Overview

RpgParadise::Mud::Settlements::Towns::Controller

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

#

initialize

#


48
49
50
51
52
53
54
55
56
57
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 48

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

RpgParadise::Mud::Settlements::Towns::Controller[]

#


149
150
151
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 149

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

Instance Method Details

#add_town(this_town) ⇒ Object Also known as: add, <<

#

add

Add a new town. Sanitize this information.

#


107
108
109
110
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 107

def add_town(this_town)
  this_town = sanitize_town(this_town)
  @array_town_listing << this_town
end

#array_town_listing?Boolean Also known as: array_town_listing

#

array_town_listing?

#

Returns:

  • (Boolean)


116
117
118
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 116

def array_town_listing?
  @array_town_listing
end

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


85
86
87
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 85

def commandline_arguments?
  @commandline_arguments
end

#debugObject

#

debug

Debug

#


140
141
142
143
144
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 140

def debug
  cliner {
    pp @array_town_listing
  }
end

#first_argument?Boolean Also known as: first?

#

first_argument?

#

Returns:

  • (Boolean)


92
93
94
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 92

def first_argument?
  @commandline_arguments.first
end

#resetObject

#

reset (reset tag)

#


62
63
64
65
66
67
68
69
70
71
72
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 62

def reset
  super()
  # ======================================================================= #
  # === @namespace
  # ======================================================================= #
  @namespace = NAMESPACE
  # ======================================================================= #
  # === @array_town_listing
  # ======================================================================= #
  @array_town_listing = [] # Keep a listing of all our towns in this array.
end

#runObject

#

run (run tag)

#


99
100
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 99

def run
end

#sanitize_town(this_town = :pingrim) ⇒ Object

#

sanitize_town

will ensure that the info is correct

#


125
126
127
128
129
130
131
132
133
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 125

def sanitize_town(this_town = :pingrim)
  _tmp = this_town.dup.to_s.downcase
  this_town = Mud::Settlement.new 
  this_town.read_and_fill_in_from_file(
    ENV['SARLEM'].to_s+'/YAML/'+_tmp+'.yml'
  )
  this_town.ensure_proper_variables
  return this_town    
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#


77
78
79
80
# File 'lib/games_and_rpg_paradise/mud/settlements/towns/controller.rb', line 77

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end