Class: EvalMacro
- Inherits:
-
MarkupMacro
- Object
- MarkupMacro
- EvalMacro
- Defined in:
- lib/assets/lib/markup_macro.rb
Overview
Evaluates ruby code placed inside the macro
Instance Attribute Summary
Attributes inherited from MarkupMacro
Instance Method Summary collapse
-
#initialize ⇒ EvalMacro
constructor
A new instance of EvalMacro.
- #process(macro, node) ⇒ Object
Constructor Details
#initialize ⇒ EvalMacro
Returns a new instance of EvalMacro.
36 37 38 39 40 |
# File 'lib/assets/lib/markup_macro.rb', line 36 def initialize @title = "Eval" @regex = /{{@@eval[\s\S]*?}}/ @extra = /{{@@eval([\s\S]*?)}}/ end |
Instance Method Details
#process(macro, node) ⇒ Object
42 43 44 45 |
# File 'lib/assets/lib/markup_macro.rb', line 42 def process(macro, node) body = @extra.match(macro)[1] eval(body, binding) end |