Module: Flok::ServicesCompiler
- Defined in:
- lib/flok/services_compiler.rb
Class Method Summary collapse
-
.compile(rb_src, rb_config) ⇒ Object
Compile a ruby file containing flok controller definitions (from the services) The config is outlined in the documentation under docs/services.md.
Class Method Details
.compile(rb_src, rb_config) ⇒ Object
Compile a ruby file containing flok controller definitions (from the services) The config is outlined in the documentation under docs/services.md
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/flok/services_compiler.rb', line 10 def self.compile rb_src, rb_config #Execute the configuration file first config_context = ServicesCompilerConfigContext.new config_context.instance_eval(rb_config, __FILE__, __LINE__) #Execute code in this context, the context will hold all the information #that is used to then generate code context = ServicesCompilerContext.new(config_context) context.instance_eval(rb_src, __FILE__, __LINE__) context.ready @src = "" services_erb = File.read File.join(File.dirname(__FILE__), "./service_compiler_templates/services.js.erb") services_renderer = ERB.new(services_erb) @src << services_renderer.result(context.get_binding) return @src end |