Class: GamesAndRpgParadise::Controller

Inherits:
Base
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/controller/controller.rb

Overview

GamesAndRpgParadise::Controller

Constant Summary

Constants included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

GamesAndRpgParadise::CommonExtensions::CONTROL_C_CODE, GamesAndRpgParadise::CommonExtensions::N

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

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

#

initialize

#


28
29
30
31
32
33
34
35
36
37
# File 'lib/games_and_rpg_paradise/controller/controller.rb', line 28

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

Class Method Details

.[](i = ARGV) ⇒ Object

#

GamesAndRpgParadise::Controller[]

#


73
74
75
# File 'lib/games_and_rpg_paradise/controller/controller.rb', line 73

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

Instance Method Details

#resetObject

#

reset (reset tag)

#


42
43
44
45
# File 'lib/games_and_rpg_paradise/controller/controller.rb', line 42

def reset
  super() if respond_to?(:super)
  infer_the_namespace
end

#runObject

#

run (run tag)

#


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/games_and_rpg_paradise/controller/controller.rb', line 50

def run
  the_western_realm  = GamesAndRpgParadise::Mud::Continent.new(:western_realm)
  _the_eastern_realm = GamesAndRpgParadise::Mud::Continent.new(:eastern_realm)
  _the_middle_realm  = GamesAndRpgParadise::Mud::Continent.new(:middle_realm)
  # Next we populate all realms. 
  the_western_realm.add_city(:kuulk, rand(800))
  the_western_realm.add_city(:landeral, rand(800))
  the_western_realm.add_city(:cilth, rand(800))
  the_western_realm.add_city(:karn, rand(800))
  e rev+'Available cities in the Western Realm:'
  e
  the_western_realm.cities?.each {|this_city|
    e '  '+steelblue(
      (this_city.name?.to_s.capitalize+':').ljust(16)
    )+
      lightblue(this_city.n_people?+' people live in this city')
  }
  e
end