Module: Papercraft::ProcExtensions
- Defined in:
- lib/papercraft/proc_ext.rb
Overview
Extensions to the Proc class.
Instance Method Summary collapse
-
#__papercraft_compiled! ⇒ self
Marks the proc as compiled, i.e.
-
#__papercraft_compiled? ⇒ bool
Returns true if proc is marked as compiled.
-
#__papercraft_compiled_proc(mode: :html) ⇒ Proc
Returns the compiled proc for the proc.
-
#__papercraft_render_cache ⇒ Hash
Returns the render cache for the proc.
Instance Method Details
#__papercraft_compiled! ⇒ self
Marks the proc as compiled, i.e. can render directly and takes a string buffer as first argument.
19 20 21 22 |
# File 'lib/papercraft/proc_ext.rb', line 19 def __papercraft_compiled! @__papercraft_compiled = true self end |
#__papercraft_compiled? ⇒ bool
Returns true if proc is marked as compiled.
11 12 13 |
# File 'lib/papercraft/proc_ext.rb', line 11 def __papercraft_compiled? @__papercraft_compiled end |
#__papercraft_compiled_proc(mode: :html) ⇒ Proc
Returns the compiled proc for the proc. If marked as compiled, returns self.
29 30 31 32 |
# File 'lib/papercraft/proc_ext.rb', line 29 def __papercraft_compiled_proc(mode: :html) @__papercraft_compiled_proc ||= @__papercraft_compiled ? self : Papercraft.compile(self, mode:) end |
#__papercraft_render_cache ⇒ Hash
Returns the render cache for the proc.
37 38 39 |
# File 'lib/papercraft/proc_ext.rb', line 37 def __papercraft_render_cache @__papercraft_render_cache ||= {} end |