class Object

Public Instance Methods

quickWrite(file, item) click to toggle source

Random methods and class modifiers to add to my own gem

# File lib/random_methods.rb, line 3
def quickWrite(file, item)
  somefile = open(file, 'a+')
  somefile.puts item
  somefile.close
end
scan_file(file, thing) click to toggle source
# File lib/random_methods.rb, line 9
def scan_file(file, thing)
  array = Array.new
  begin
    somefile = open(file, 'r')

    somefile.readlines do |line|
        if line.match(/#{thing}/) then
          array += true
        else
          array += false
        end
    end
    somefile.close
    return array
  rescue
    return nil
  end
end