Module: GamesParadise::BaseModule
- Included in:
- Base, GUI::HangmanGameWindow, VierGewinnt
- Defined in:
- lib/games_paradise/base/base_module/base_module.rb
Instance Method Summary collapse
-
#cliner ⇒ Object
# === cliner ========================================================================= #.
-
#commandline_arguments? ⇒ Boolean
# === commandline_arguments? ========================================================================= #.
-
#first_argument? ⇒ Boolean
(also: #first?)
# === first_argument? ========================================================================= #.
-
#infer_the_namespace ⇒ Object
# === infer_the_namespace.
-
#namespace? ⇒ Boolean
# === namespace? ========================================================================= #.
-
#rename_file(old, new) ⇒ Object
# === rename_file ========================================================================= #.
-
#reset_the_internal_hash ⇒ Object
# === reset_the_internal_hash ========================================================================= #.
-
#return_pwd ⇒ Object
# === return_pwd ========================================================================= #.
-
#set_commandline_arguments(i = '') ⇒ Object
# === set_commandline_arguments ========================================================================= #.
Instance Method Details
#cliner ⇒ Object
#
cliner
#
64 65 66 67 68 69 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 64 def cliner begin require 'cliner' unless Object.const_defined?(:Cliner) ::Cliner.cliner rescue LoadError; end end |
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
#
50 51 52 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 50 def commandline_arguments? @commandline_arguments end |
#first_argument? ⇒ Boolean Also known as: first?
#
first_argument?
#
57 58 59 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 57 def first_argument? @commandline_arguments.first end |
#infer_the_namespace ⇒ Object
#
infer_the_namespace
This will assume the true namespace from the inspectable name.
#
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 25 def infer_the_namespace _ = inspect.to_s.delete('<') if _.include? ' ' _ = _.split(' ').first.delete('#') if _.include? ':' _ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::') end end if _.include?(':0') _ = _.split(':0').first.to_s end @namespace = _.delete('#') # And assign it here. end |
#namespace? ⇒ Boolean
#
namespace?
#
16 17 18 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 16 def namespace? @namespace end |
#rename_file(old, new) ⇒ Object
#
rename_file
#
88 89 90 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 88 def rename_file(old, new) FileUtils.mv(old, new) end |
#reset_the_internal_hash ⇒ Object
#
reset_the_internal_hash
#
81 82 83 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 81 def reset_the_internal_hash @internal_hash = {} end |
#return_pwd ⇒ Object
#
return_pwd
#
74 75 76 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 74 def return_pwd "#{Dir.pwd}/".squeeze('/') end |
#set_commandline_arguments(i = '') ⇒ Object
#
set_commandline_arguments
#
42 43 44 45 |
# File 'lib/games_paradise/base/base_module/base_module.rb', line 42 def set_commandline_arguments(i = '') i = [i].flatten.compact @commandline_arguments = i end |