Trying to use some global variable
$buffer = Array.new
4
5 def save_log(data, file_name)
6 puts ‘save log called ‘+file_name
7 open(file_name, ‘w’) { |f| f.write(data) }
8 end
9
10 def get_citations_from_page(data, start_point, end_point)
11 citations = get_substring_within_inclusive(data,
start_point, end_point)
12 u_arr = getURLsFromPage(‘http://www.xxxx.com/’, citations)
13 u_arr.each {
14 |t|
15 if
(!beginsWith(t[1],‘XXXX’))
16 buffer.push t[0]+’%%%’+t[1]
17 end
18 }
19 end
getting error:
xxxx_citations.rb:16:in get_citations_from_page': undefined local variable or method
buffer’ for main:Object (NameError)
from xxxx_citations.rb:13:in each' from xxxx_citations.rb:13:in
get_citations_from_page’
from xxxx_citations.rb:26:in retrieve_citations' from xxxx_citations.rb:46 from xxxx_citations.rb:42:in
open’
from xxxx_citations.rb:4
Why? How to solve it?