Sha256: 4b8810df2ec489f8dd823725e230185372c48b4830b1c8da536a82b66298ac2f
Contents?: true
Size: 455 Bytes
Versions: 4
Compression:
Stored size: 455 Bytes
Contents
require 'erb' module IRust class TemplateRenderer RUST_TEMPLATE = File.expand_path("../template.rs.erb", __FILE__) attr_reader :rust_code, :history def initialize(rust_code, history = nil) @rust_code, @history = rust_code, history end def render template = File.read(RUST_TEMPLATE) ERB.new(template).result(binding) end def let_var rust_code[/^\s*(let|fn)\s+(mut\s+)?(\w+)/, 3] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
irust-1.2.0 | lib/irust/template_renderer.rb |
irust-1.1.2 | lib/irust/template_renderer.rb |
irust-1.1.1 | lib/irust/template_renderer.rb |
irust-1.1.0 | lib/irust/template_renderer.rb |