Class: RQueryHook

Inherits:
Mumukit::Templates::FileHook
  • Object
show all
Defined in:
lib/query_hook.rb

Instance Method Summary collapse

Instance Method Details

#command_line(filename) ⇒ Object



33
34
35
# File 'lib/query_hook.rb', line 33

def command_line(filename)
  "Rscript #{filename}"
end


27
28
29
30
31
# File 'lib/query_hook.rb', line 27

def compile_cookie(cookie)
  return if cookie.blank?

  compile_statements(cookie).join "\n"
end

#compile_file_content(r) ⇒ Object



9
10
11
# File 'lib/query_hook.rb', line 9

def compile_file_content(r)
  "#{compile_file_header(r)}\n#{compile_query(r.query)}"
end

#compile_file_header(r) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/query_hook.rb', line 13

def compile_file_header(r)
<<R
#{r.extra}

#{r.content}

#{compile_cookie(r.cookie)}
R
end

#compile_query(query) ⇒ Object



23
24
25
# File 'lib/query_hook.rb', line 23

def compile_query(query)
  query
end

#tempfile_extensionObject



5
6
7
# File 'lib/query_hook.rb', line 5

def tempfile_extension
  '.R'
end