class ChemistryParadise::ShowElectronNegativityOfThisElement

Constants

NAMESPACE
#

NAMESPACE

#

Public Class Methods

[](i = '') click to toggle source
#

[]

#
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 93
def self.[](i = '')
  self.new(i)
end
new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 29
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(i)
  run if run_already
end

Public Instance Methods

input?() click to toggle source
#

input?

#
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 57
def input?
  @input
end
opnn() click to toggle source
#

opnn

#
Calls superclass method ChemistryParadise::Base#opnn
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 86
def opnn
  super(NAMESPACE)
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method ChemistryParadise::Base#reset
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 41
def reset
  super()
  @dataset = Constants::ELECTRON_NEGATIVITY_CHART
end
run() click to toggle source
#

run (run tag)

#
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 64
def run
  try_to_detect_the_electron_negativity_of_the_passed_elements
end
set_input(i = '') click to toggle source
#

set_input

#
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 49
def set_input(i = '')
  i = [i] unless i.is_a? Array
  @input = i
end
try_to_detect_the_electron_negativity_of_the_passed_elements() click to toggle source
#

try_to_detect_the_electron_negativity_of_the_passed_elements

#
# File lib/chemistry_paradise/show_electron_negativity_of_this_element.rb, line 71
def try_to_detect_the_electron_negativity_of_the_passed_elements
  dataset = @dataset
  input?.each {|this_element|
    if dataset.has_key? this_element
      electron_negativity_value = dataset[this_element]
      e "#{simp(this_element.ljust(2))} has an electron negativity of "\
        "#{sfancy(electron_negativity_value)}"\
        " (in this Pauling electronegativity scale)"
    end
  }
end