class ChemistryParadise::InteractiveChemistryShell
Constants
- PERIODIC_TABLE
- PROMPT
#¶ ↑
PROMPT
¶ ↑#¶ ↑
Public Class Methods
Public Instance Methods
calculate(i)
click to toggle source
#¶ ↑
calculate¶ ↑
To test this, do:
calc C3H5
#¶ ↑
# File lib/chemistry_paradise/interactive_chemistry_shell.rb, line 77 def calculate(i) if i.nil? e 'Please provide proper input to this method now, for instance, `C12H12N2`:' i = $stdin.gets.chomp end CalculateAtomicMass.new(i) end
Also aliased as: calc
colourize_via_kde_konsole(i)
click to toggle source
ecomment(i)
click to toggle source
fetch_user_input()
click to toggle source
has_readline?()
click to toggle source
report_input(i)
click to toggle source
reset()
click to toggle source
run()
click to toggle source
run_loop()
click to toggle source
show_help()
click to toggle source
#¶ ↑
show_help
¶ ↑
#¶ ↑
# File lib/chemistry_paradise/interactive_chemistry_shell.rb, line 170 def show_help # help tag e 'Available options:' e # ======================================================================= # # Add more documented help-options to this Array here. # ======================================================================= # array = [ 'calculate the atomic mass', 'show the electron configuration of an Element', 'show the periodic table', 'show electron negativity chart' ] array.each_with_index {|entry, index| index += 1 ecomment @lpad+index.to_s+' # '+entry } end
show_periodic_table()
click to toggle source
#¶ ↑
show_periodic_table
¶ ↑
#¶ ↑
# File lib/chemistry_paradise/interactive_chemistry_shell.rb, line 209 def show_periodic_table e # Add a newline. inverted = PERIODIC_TABLE.invert 1.upto(7).each {|periode| range = return_range_for_this_period(periode) # ===================================================================== # # Now we have a proper range. # ===================================================================== # matches = inverted.select {|index_position, value| range.include? index_position } ee colourize_via_kde_konsole(periode.to_s)+': ' # Display the periode here. matches.each_pair {|key, value| ee simp(value)+' ('+key.to_s+') ' }; e } end
show_welcome_message()
click to toggle source