5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/var_parser.rb', line 5
def self.(filepath)
puts 'Starting Extraction from file ........'+ARGF.filename
vars = []
File.open(filepath, "r") do |f|
f.each_line do |line|
x=-1
print '..'
(0...line.size).each do |ch|
break if line[ch] == '#'
if x == -1 && line[ch] == '@'
x = ch
next
end
if /[A-Za-z0-9_]/.match(line[ch]).nil? && x!=-1
vars.push(line[x...ch])
x = -1
end end end end
puts ''
puts 'Extraction complete'
puts vars.uniq.inspect
return vars
end
|