Class: ERB

Inherits:
Object
  • Object
show all
Defined in:
lib/cast_off/compile/namespace/namespace.rb

Overview

This is a hack, not to hold entire output on-memory. A YARV-converted C sourcecode can be huge, in order of megabytes. It is not a wise idea for you to allocate such a large string at once.

Taken from: d.hatena.ne.jp/m_seki/20100228#1267314143

Instance Method Summary collapse

Instance Method Details

#set_eoutvar(c, e) ⇒ Object



250
251
252
253
254
# File 'lib/cast_off/compile/namespace/namespace.rb', line 250

def set_eoutvar c, e
  c.pre_cmd = ["#{e} ||= ''"]
  c.post_cmd = []
  c.put_cmd = c.insert_cmd = "#{e} << "
end

#trigger(b) ⇒ Object



256
257
258
# File 'lib/cast_off/compile/namespace/namespace.rb', line 256

def trigger b
  eval @src, b, '(erb)', 0
end