class RTryHook

Attributes

query_hook[R]

Public Class Methods

new(config = nil) click to toggle source
Calls superclass method
# File lib/try_hook.rb, line 5
def initialize(config = nil)
  super config
  @query_hook = RQueryHook.new
end

Public Instance Methods

compile_file_content(r) click to toggle source
# File lib/try_hook.rb, line 10
  def compile_file_content(r)
    <<R
#{@query_hook.compile_file_header(r)}
cat("#{query_separator}", fill = TRUE);
#{@query_hook.compile_query(r.query)}
cat("#{goal_separator}", fill = TRUE);
#{@query_hook.compile_query(r.goal.with_indifferent_access[:query] || 'NULL')}
R
  end
goal_separator() click to toggle source
# File lib/try_hook.rb, line 27
def goal_separator
  '!!!MUMUKI-GOAL-START!!!'
end
query_separator() click to toggle source
# File lib/try_hook.rb, line 23
def query_separator
  '!!!MUMUKI-QUERY-START!!!'
end
to_query_result(result, status) click to toggle source
# File lib/try_hook.rb, line 44
def to_query_result(result, status)
  { result: result, status: status }
end
to_structured_results(_file, result, status) click to toggle source
# File lib/try_hook.rb, line 31
  def to_structured_results(_file, result, status)
    /#{query_separator}
?(.*)
#{goal_separator}
?(.*)
/m =~ result
    {
        query: to_query_result($1, status),
        goal: $2,
        status: status
    }
  end