Module: Studium::RunmodeModule
- Included in:
- Base
- Defined in:
- lib/studium/base/runmode_module/runmode_module.rb
Overview
Studium::RunmodeModule
Instance Method Summary collapse
-
#commandline? ⇒ Boolean
(also: #cmdline?, #commandline_mode?)
# === commandline?.
-
#runmode? ⇒ Boolean
(also: #mode?)
# === runmode? ========================================================================= #.
-
#set_commandline_mode ⇒ Object
(also: #set_commandline)
# === set_commandline_mode ========================================================================= #.
-
#set_runmode(i = ::Studium::Exams.runmode?) ⇒ Object
(also: #set_mode)
# === set_runmode.
-
#set_www_mode ⇒ Object
(also: #www_mode, #enable_www_mode)
# === set_www_mode.
-
#www_mode? ⇒ Boolean
(also: #is_on_www?, #are_we_in_www_mode?, #in_www_mode?)
# === www_mode?.
Instance Method Details
#commandline? ⇒ Boolean Also known as: cmdline?, commandline_mode?
#
commandline?
Whether we run in commandline mode or not. Will return true or false.
#
70 71 72 |
# File 'lib/studium/base/runmode_module/runmode_module.rb', line 70 def commandline? runmode? == :commandline end |
#runmode? ⇒ Boolean Also known as: mode?
#
runmode?
#
88 89 90 |
# File 'lib/studium/base/runmode_module/runmode_module.rb', line 88 def runmode? @internal_hash[:runmode] end |
#set_commandline_mode ⇒ Object Also known as: set_commandline
#
set_commandline_mode
#
61 62 63 |
# File 'lib/studium/base/runmode_module/runmode_module.rb', line 61 def set_commandline_mode set_mode :commandline end |
#set_runmode(i = ::Studium::Exams.runmode?) ⇒ Object Also known as: set_mode
#
set_runmode
This method will delegate towards Exams.set_runmode.
We have three valid modes, which can be passed as argument to this method here, as a Symbol:
(1) :commandline
(2) :www
(3) :gui
The default one is :commandline.
We tap into the class-method Exams.runmode? by default, which will be equal to passing :commandline.
#
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/studium/base/runmode_module/runmode_module.rb', line 30 def set_runmode( i = ::Studium::Exams.runmode? ) case i # ======================================================================= # # === :default # ======================================================================= # when :default i = :commandline end @internal_hash[:runmode] = i # ======================================================================= # # Also synchronize it into the whole studium-project. For this, we # require the toplevel-method called Studium.set_runmode(). # # Disabled this as of July 2020 as it interferes with .cgi scripts. # ======================================================================= # # ::Studium.set_runmode(@runmode) unless ::Studium::Exams.frozen? case i # ======================================================================= # # === :www # ======================================================================= # when :www, :gui # WWW mode and GUI mode do not use the commandline-colours. Studium.disable_colours # Disable colours in this case. disable_colours end end |
#set_www_mode ⇒ Object Also known as: www_mode, enable_www_mode
#
set_www_mode
Set to :www runmode through this method.
#
80 81 82 |
# File 'lib/studium/base/runmode_module/runmode_module.rb', line 80 def set_www_mode set_runmode :www end |
#www_mode? ⇒ Boolean Also known as: is_on_www?, are_we_in_www_mode?, in_www_mode?
#
www_mode?
This method will return true if we run in www mode.
#
97 98 99 |
# File 'lib/studium/base/runmode_module/runmode_module.rb', line 97 def www_mode? runmode? == :www end |