Class: ChemistryParadise::Base

Inherits:
Object
  • Object
show all
Includes:
Constants, Shared
Defined in:
lib/chemistry_paradise/base/base.rb,
lib/chemistry_paradise/base/colours.rb

Overview

ChemistryParadise::Base

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
FILE_MOLECULAR_FORMULA_OF_DIFFERENT_MOLECULES =
#

FILE_MOLECULAR_FORMULA_OF_DIFFERENT_MOLECULES

#
"#{PROJECT_BASE_DIRECTORY}yaml/molecular_formula_of_different_molecules.yml"

Constants included from Shared

Shared::ARRAY_TEST_THESE_MOLECULES

Constants included from Constants

Constants::ELECTRON_NEGATIVITY_CHART, Constants::FILE_ATOMGEWICHTE, Constants::FILE_ELECTRON_NEGATIVITY_CHART, Constants::FILE_PERIODIC_TABLE_OF_THE_ELEMENTS, Constants::N, Constants::PLANK_CONSTANT, Constants::PROPER_FILLORDER, Constants::SPEED_OF_LIGHT

Instance Method Summary collapse

Methods included from Shared

#convert_parens, #is_number?, #periodic_table?, periodic_table?, #return_range_for_this_period, #square

Methods included from Constants

#electron_negativity_chart?

Instance Method Details

#be_quietObject Also known as: be_silent, set_be_quiet

#

be_quiet

#


203
204
205
# File 'lib/chemistry_paradise/base/base.rb', line 203

def be_quiet
  @be_verbose = false
end

#be_verbose?Boolean Also known as: be_verbose

#

be_verbose?

#

Returns:

  • (Boolean)


211
212
213
# File 'lib/chemistry_paradise/base/base.rb', line 211

def be_verbose?
  @be_verbose
end

#cd(i) ⇒ Object

#

cd (cd tag)

#


140
141
142
# File 'lib/chemistry_paradise/base/base.rb', line 140

def cd(i)
  Dir.chdir(i)
end

#clinerObject

#

cliner

This variant will return rather than output/display.

#


133
134
135
# File 'lib/chemistry_paradise/base/base.rb', line 133

def cliner
  '=' * 80
end

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


103
104
105
# File 'lib/chemistry_paradise/base/base.rb', line 103

def commandline_arguments?
  @commandline_arguments
end

#do_use_the_english_languageObject

#

do_use_the_english_language

#


124
125
126
# File 'lib/chemistry_paradise/base/base.rb', line 124

def do_use_the_english_language
  ::ChemistryParadise.do_use_english
end

#do_use_the_german_languageObject

#

do_use_the_german_language

#


117
118
119
# File 'lib/chemistry_paradise/base/base.rb', line 117

def do_use_the_german_language
  ::ChemistryParadise.do_use_german
end

#do_we_use_english?Boolean

#

do_we_use_english?

Query method to determine whether we will use english or whether we will use another language, for a project-wide setting.

#

Returns:

  • (Boolean)


88
89
90
# File 'lib/chemistry_paradise/base/base.rb', line 88

def do_we_use_english?
  (use_which_language? == :english)
end

#esystem(i, silence_output_from_system = false, &block) ⇒ Object

#

esystem (system tag)

#


147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/chemistry_paradise/base/base.rb', line 147

def esystem(
    i,
    silence_output_from_system = false,
    &block
  )
  yielded = nil
  if block_given?
    yielded = yield
  end
  case yielded
  # ======================================================================= #
  # === :be_quiet
  # ======================================================================= #
  when :be_quiet
  else # This is the default.
    puts i
  end
  case silence_output_from_system
  # ======================================================================= #
  # === :silence_output_from_system
  # ======================================================================= #
  when :silence_output_from_system
    silence_output_from_system = true
  end
  if silence_output_from_system
    # system i, out: File::NULL
    `#{i} 2>&1`
  else
    system i
  end
end

#first_argument?Boolean Also known as: first?

#

first_argument?

#

Returns:

  • (Boolean)


110
111
112
# File 'lib/chemistry_paradise/base/base.rb', line 110

def first_argument?
  @commandline_arguments.first
end

#gold(i = '') ⇒ Object

#

gold

#


89
90
91
# File 'lib/chemistry_paradise/base/colours.rb', line 89

def gold(i = '')
  ::Colours.gold(i)
end

#grey(i = '') ⇒ Object

#

grey

#


33
34
35
# File 'lib/chemistry_paradise/base/colours.rb', line 33

def grey(i = '')
  "#{::Colours::GREY}#{i}#{Colours}#{rev}"
end

#initialize_the_internal_hashObject

#

initialize_the_internal_hash

#


51
52
53
54
55
56
# File 'lib/chemistry_paradise/base/base.rb', line 51

def initialize_the_internal_hash
  # ======================================================================= #
  # === @internal_hash
  # ======================================================================= #
  @internal_hash = {}
end

#internal_hash?Boolean Also known as: internal_hash

#

internal_hash?

#

Returns:

  • (Boolean)


61
62
63
# File 'lib/chemistry_paradise/base/base.rb', line 61

def internal_hash?
  @internal_hash
end

#is_on_roebe?Boolean

#

is_on_roebe?

#

Returns:

  • (Boolean)


182
183
184
# File 'lib/chemistry_paradise/base/base.rb', line 182

def is_on_roebe?
  ChemistryParadise.is_on_roebe?
end

#mediumpurple(i = '') ⇒ Object

#

mediumpurple

#


75
76
77
# File 'lib/chemistry_paradise/base/colours.rb', line 75

def mediumpurple(i = '')
  ::Colours.mediumpurple(i)
end

#namespace?Boolean

#

namespace?

#

Returns:

  • (Boolean)


189
190
191
# File 'lib/chemistry_paradise/base/base.rb', line 189

def namespace?
  @namespace
end

#olivedrab(i = '') ⇒ Object

#

olivedrab

#


82
83
84
# File 'lib/chemistry_paradise/base/colours.rb', line 82

def olivedrab(i = '')
  ::Colours.olivedrab(i)
end

#opnn(i) ⇒ Object

#

opnn

#


68
69
70
71
72
73
# File 'lib/chemistry_paradise/base/base.rb', line 68

def opnn(i)
  if i.is_a? String
    i = { namespace: i }
  end
  Opn.opn(i) # Delegate to module Opn here.
end

#resetObject

#

reset (reset tag)

#


41
42
43
44
45
46
# File 'lib/chemistry_paradise/base/base.rb', line 41

def reset
  # ======================================================================= #
  # === @be_verbose
  # ======================================================================= #
  @be_verbose = true
end

#revObject

#

rev

#


19
20
21
# File 'lib/chemistry_paradise/base/colours.rb', line 19

def rev
  ::Colours.rev
end

#royalblue(i = '') ⇒ Object

#

royalblue

#


68
69
70
# File 'lib/chemistry_paradise/base/colours.rb', line 68

def royalblue(i = '')
  ::Colours.royalblue(i)
end

#set_be_verboseObject

#

set_be_verbose

#


196
197
198
# File 'lib/chemistry_paradise/base/base.rb', line 196

def set_be_verbose
  @be_verbose = true
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#


95
96
97
98
# File 'lib/chemistry_paradise/base/base.rb', line 95

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end

#sfancy(i = '') ⇒ Object

#

sfancy

#


26
27
28
# File 'lib/chemistry_paradise/base/colours.rb', line 26

def sfancy(i = '')
  ::Colours.sfancy(i)
end

#steelblue(i = '') ⇒ Object

#

steelblue

#


40
41
42
# File 'lib/chemistry_paradise/base/colours.rb', line 40

def steelblue(i = '')
  ::Colours.steelblue(i)
end

#teal(i = '') ⇒ Object

#

teal

#


54
55
56
# File 'lib/chemistry_paradise/base/colours.rb', line 54

def teal(i = '')
  ::Colours.teal(i)
end

#tomato(i = '') ⇒ Object

#

tomato

#


61
62
63
# File 'lib/chemistry_paradise/base/colours.rb', line 61

def tomato(i = '')
  ::Colours.tomato(i)
end

#use_which_language?Boolean

#

use_which_language?

#

Returns:

  • (Boolean)


78
79
80
# File 'lib/chemistry_paradise/base/base.rb', line 78

def use_which_language?
  ::ChemistryParadise.use_which_language?
end

#yellow(i = '') ⇒ Object

#

yellow

#


47
48
49
# File 'lib/chemistry_paradise/base/colours.rb', line 47

def yellow(i = '')
  ::Colours.yellow(i)
end