class RBT::Cookbooks::CreateGlobalYamlDatabase

Constants

STORE_HERE
#

STORE_HERE

#

Public Class Methods

new( run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/generate_files/create_global_yaml_database.rb, line 32
def initialize(
    run_already = true
  )
  reset
  run if run_already
end
store_where?() click to toggle source
#

CreateGlobalYamlDatabase.store_where?

#
# File lib/rbt/generate_files/create_global_yaml_database.rb, line 54
def self.store_where?
  STORE_HERE
end

Public Instance Methods

iterate_over_every_program() click to toggle source
#

iterate_over_every_program

#
# File lib/rbt/generate_files/create_global_yaml_database.rb, line 81
def iterate_over_every_program
  @all_programs.each_with_index {|program, index|
    dataset = RBT::Cookbooks::SanitizeCookbook.new(program)
    dataset = dataset.dataset?
    hash = {}
    hash[program] = dataset
    _ = {}
    dataset.each_pair {|key, value|
      if key
        _[key] = value
      end
    }
    dataset = _
    opne "Now working on the program `#{royalblue(program)}`."
    @dataset.update(hash)
  }
end
obtain_all_programs() click to toggle source
#

obtain_all_programs

#
# File lib/rbt/generate_files/create_global_yaml_database.rb, line 74
def obtain_all_programs
  @all_programs = available_programs?
end
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/generate_files/create_global_yaml_database.rb, line 42
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @dataset
  # ======================================================================= #
  @dataset = Hash.new # This is the main hash of this class.
end
run() click to toggle source
#

run

#
# File lib/rbt/generate_files/create_global_yaml_database.rb, line 102
def run
  obtain_all_programs
  iterate_over_every_program
  store_into_yaml_file
end
store_into_yaml_file() click to toggle source
#

store_into_yaml_file

#
# File lib/rbt/generate_files/create_global_yaml_database.rb, line 61
def store_into_yaml_file
  into = STORE_HERE
  opne "Now storing into `#{sfile(into)}`."
  if File.exist? into
    File.delete(into) # Always get rid of the old yaml file first.
  end
  what = YAML.dump(@dataset)
  save_what_into(what, into)
end