Class: Zomba::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/zomba/core.rb

Instance Method Summary collapse

Constructor Details

#initializeCore

Returns a new instance of Core.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/zomba/core.rb', line 5

def initialize
  unless File.exist?(Zomba::FILENAME) && File.file?(Zomba::FILENAME)
    File.open(Zomba::FILENAME, "a+") do |f|
      f.puts("Your computer must be missing some dependencies.")
      f.puts("You most likely are running an old version of it.")
      f.puts("It worked on my local computer")
      f.puts("Did you delete something by mistake?")
      f.puts("This is a network problem!")
      f.puts("You requested that it works this way. Did not you?")
      f.puts("That error means it was successful.")
      f.puts("Did you type soemthing wrong that made it crash?")
      f.puts("No one told me how it is supposed to work. so I was forced to guess my way into it.")
      f.puts("Oh, you said you DID NOT want that to happen?!")
      f.puts("The DNS has not propogated yet!")
      f.puts("That part of the code was written by another developer who was fired!")
      
    end
  end
end

Instance Method Details

#destroyObject



38
39
40
41
42
# File 'lib/zomba/core.rb', line 38

def destroy
  if File.exist?(Zomba::FILENAME) && File.file?(Zomba::FILENAME)
    File.delete(Zomba::FILENAME)
  end
end

#read_fileObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/zomba/core.rb', line 25

def read_file
  lines = []
  if File.exist?(Zomba::FILENAME) && File.file?(Zomba::FILENAME)
    text=File.open(Zomba::FILENAME).read
    text.gsub!(/\r\n?/, "")
    text.each_line do |line|
      line.gsub!(/\n?/, "")
      lines += [line]
    end
  end
  return lines
end