Class: GamesAndRpgParadise::CreateEmptyGamebookSkeleton

Inherits:
Base
  • Object
show all
Includes:
Base::ExtensionsForAGamebook
Defined in:
lib/games_and_rpg_paradise/gamebooks/create_empty_gamebook_skeleton.rb

Overview

GamesAndRpgParadise::CreateEmptyGamebookSkeleton

Constant Summary

Constants included from Base::ExtensionsForAGamebook

Base::ExtensionsForAGamebook::DIRECTORY_FOR_THE_GAMEBOOKS

Constants included from CommonExtensions

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

Constants included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::ExtensionsForAGamebook

#available_gamebooks?, #io_download, #roll_this_die, use_gtk?, #use_gtk?, #wget, #yaml_gamebooks_dir?

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

Methods included from Base::Extensions::Colours

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

Constructor Details

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

#

initialize

#


29
30
31
32
33
34
35
36
37
38
# File 'lib/games_and_rpg_paradise/gamebooks/create_empty_gamebook_skeleton.rb', line 29

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::CreateEmptyGamebookSkeleton[]

#


89
90
91
# File 'lib/games_and_rpg_paradise/gamebooks/create_empty_gamebook_skeleton.rb', line 89

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

Instance Method Details

#generate_n_sections_in_the_yaml_file(i = 400) ⇒ Object

#

generate_n_sections_in_the_yaml_file

#


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/games_and_rpg_paradise/gamebooks/create_empty_gamebook_skeleton.rb', line 63

def generate_n_sections_in_the_yaml_file(i = 400)
  _ = ''.dup
  i.to_i.times {|iteration_n| iteration_n += 1
    append_this = <<-EOF

# =========================================================================== #
# === #{iteration_n}
# =========================================================================== #
#{iteration_n}:
 content: |

 exits:
#{iteration_n}: |
 (#{iteration_n}).

EOF
    _ << append_this
  }
  into = log_dir?+'gamebook.yml'
  e 'Storing into the file `'+sfile(into)+'`.'
  write_what_into(_, into)
end

#resetObject

#

reset (reset tag)

#


43
44
45
46
# File 'lib/games_and_rpg_paradise/gamebooks/create_empty_gamebook_skeleton.rb', line 43

def reset
  super()
  infer_the_namespace
end

#runObject

#

run (run tag)

#


51
52
53
54
55
56
57
58
# File 'lib/games_and_rpg_paradise/gamebooks/create_empty_gamebook_skeleton.rb', line 51

def run
  _ = first_argument?.to_i
  case _
  when 0
    _ = 400
  end
  generate_n_sections_in_the_yaml_file(_)
end