Class: ElixirQueryHook
- Inherits:
-
Mumukit::Templates::FileHook
- Object
- Mumukit::Templates::FileHook
- ElixirQueryHook
- Defined in:
- lib/query_hook.rb
Instance Method Summary collapse
- #command_line(filename) ⇒ Object
- #compile_cookie(cookie) ⇒ Object
- #compile_file_content(r) ⇒ Object
- #compile_query(query) ⇒ Object
- #tempfile_extension ⇒ Object
Instance Method Details
#command_line(filename) ⇒ Object
38 39 40 |
# File 'lib/query_hook.rb', line 38 def command_line(filename) "elixir #{filename}" end |
#compile_cookie(cookie) ⇒ Object
33 34 35 36 |
# File 'lib/query_hook.rb', line 33 def () return if .blank? .join("\n") end |
#compile_file_content(r) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/query_hook.rb', line 9 def compile_file_content(r) <<elixir defmodule ElixirServer do try do #{r.extra} #{r.content} #{(r.)} #{compile_query(r.query)} catch _ -> IO.puts "" end end elixir end |
#compile_query(query) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/query_hook.rb', line 25 def compile_query(query) if query.start_with? 'def ' "#{query}\nIO.puts \"<function>\"" else "IO.inspect #{query}" end end |
#tempfile_extension ⇒ Object
4 5 6 |
# File 'lib/query_hook.rb', line 4 def tempfile_extension '.exs' end |