Module: GamesParadise::BaseModule

Included in:
Base, GUI::HangmanGameWindow, VierGewinnt
Defined in:
lib/games_paradise/base/base_module/base_module.rb

Instance Method Summary collapse

Instance Method Details

#clinerObject

#

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?

#

Returns:

  • (Boolean)


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?

#

Returns:

  • (Boolean)


57
58
59
# File 'lib/games_paradise/base/base_module/base_module.rb', line 57

def first_argument?
  @commandline_arguments.first
end

#infer_the_namespaceObject

#

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?

#

Returns:

  • (Boolean)


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_hashObject

#

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_pwdObject

#

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