Top Level Namespace

Defined Under Namespace

Classes: Array, String

Instance Method Summary collapse

Instance Method Details

#quickWrite(file, item) ⇒ Object

Random methods and class modifiers to add to my own gem



3
4
5
6
7
# 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) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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