module SCAnalytics
Constants
- VERSION
Public Instance Methods
alert(status)
click to toggle source
# File lib/sc_analytics.rb, line 39 def alert(status) curr_time = Time.now puts "#{curr_time.strftime("%m/%d/%Y %H:%M:%S")} #{status}" puts return curr_time end
open_excel_file(file_name)
click to toggle source
# File lib/sc_analytics.rb, line 46 def open_excel_file(file_name) excel_instance.Workbooks.open("#{Dir.pwd}/#{file_name}") nil end
quit_excel()
click to toggle source
# File lib/sc_analytics.rb, line 61 def quit_excel excel_instance.quit nil end
run_excel_macro(macro_name, arg = nil)
click to toggle source
# File lib/sc_analytics.rb, line 51 def run_excel_macro(macro_name, arg = nil) if arg excel_instance.run(macro_name, arg) else excel_instance.run(macro_name) end nil end
run_in_parallel(*queries)
click to toggle source
# File lib/sc_analytics.rb, line 26 def run_in_parallel(*queries) queries.each { |query| raise "cannot run forked query #{qry.name} in parallel with other queries" if query.forked? && queries.length > 1 } threads = [] queries.each do |query| threads << Thread.new(query) do |qry| qry.run end end threads.each{|thread| thread.join } end
run_query(*queries)
click to toggle source
# File lib/sc_analytics.rb, line 20 def run_query(*queries) queries.each{|qry| qry.run } end
Also aliased as: run_queries, run_in_sequence
Private Instance Methods
excel_instance()
click to toggle source
# File lib/sc_analytics.rb, line 68 def excel_instance @excel = WIN32OLE.new('Excel.Application') unless @excel @excel.visible = true @excel end