Class: Mumukit::Templates::FileHook
Instance Attribute Summary
Attributes inherited from Hook
#config
Class Method Summary
collapse
Instance Method Summary
collapse
#create_tempfile, #tempfile_extension, #with_tempfile, #write_tempfile!
Methods inherited from Hook
#env, #initialize, #logger, #method_missing, #should_forward_to_config?, stateful_through, #t
#content_type
Constructor Details
This class inherits a constructor from Mumukit::Hook
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Mumukit::Hook
Class Method Details
.isolated(value = true) ⇒ Object
.mashup(*args) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/mumukit/templates/file_hook.rb', line 39
def self.mashup(*args)
include Mumukit::Templates::WithMashupFileContent
args = args.present? ? args : [:extra, :content, :test]
if args
define_method(:mashup_fields) { args }
end
end
|
.structured(value = true) ⇒ Object
Instance Method Details
#compile(request) ⇒ Object
5
6
7
|
# File 'lib/mumukit/templates/file_hook.rb', line 5
def compile(request)
write_tempfile! compile_file_content(request)
end
|
#post_process_file(file, result, status) ⇒ Object
16
17
18
|
# File 'lib/mumukit/templates/file_hook.rb', line 16
def post_process_file(file, result, status)
[result, status]
end
|
#run!(file) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/mumukit/templates/file_hook.rb', line 9
def run!(file)
result, status = run_file!(file)
post_process_file(file, result.force_encoding('UTF-8'), status)
ensure
file.unlink
end
|