Class: BaseDato

Inherits:
Object
  • Object
show all
Defined in:
lib/cobreak/function_hash.rb

Instance Method Summary collapse

Constructor Details

#initialize(alg = nil) ⇒ BaseDato

Returns a new instance of BaseDato.



7
8
9
# File 'lib/cobreak/function_hash.rb', line 7

def initialize(alg = nil)
@alg = alg
end

Instance Method Details

#database(alg) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cobreak/function_hash.rb', line 10

def database(alg)
  var1 = File.join(Gem.path[1], "gems", "cobreak-#{CoBreak.version}", 'lib', 'cobreak', 'hash', 'hash.db')
  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