module GenBrain class Generator attr_accessor :title, :p_inc, :p_dec, :v_inc, :v_dec, :output, :input, :jump_forward, :jump_back def initialize(config) @title = config["title"] @p_inc = config["p_inc"] @p_dec = config["p_dec"] @v_inc = config["v_inc"] @v_dec = config["v_dec"] @output= config["output"] @input = config["input"] @jump_forward = config["jump_forward"] @jump_back = config["jump_back"] end def words [ p_inc, p_dec, v_inc, v_dec, output, input, jump_forward, jump_back ].map{|word|Regexp.escape(word)}.join('|') end def call File.write("#{title}.rb", lang) File.write("#{title}_hello_world", hello_world_input_sample) puts "🎉 Created #{title}.rb and #{title}_hello_world" puts "🌈 Let's execute the following code!!" puts "#=> ruby #{title}.rb #{title}_hello_world" end def lang class_name = title.split(/[^[:alnum:]]+/).map(&:capitalize).join <