Method: DataBase#database
- Defined in:
- lib/cobreak/function_db.rb
#database(alg, var1) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cobreak/function_db.rb', line 10 def database(alg, var1) if File.exists?(var1) == false FileUtils.touch(var1) end IO.foreach(var1) {|line| line.chomp! $db[:database] << {text_db:line} } if ($db[:database].filter(text_db:alg).map(:text_db)).include?(alg) == true exit end File.open(var1, mode: 'a'){|lin| lin.puts alg } end |