class Smartdown::Engine::Interpolator
Constants
- DEFAULT_INTERPOLATOR
- INTERPOLATOR_CONFIG
Public Instance Methods
call(node, state)
click to toggle source
# File lib/smartdown/engine/interpolator.rb, line 8 def call(node, state) node.dup.tap do |new_node| new_node.elements = interpolate_elements(node.elements, state) end end
Private Instance Methods
interpolate_elements(elements, state)
click to toggle source
# File lib/smartdown/engine/interpolator.rb, line 19 def interpolate_elements(elements, state) elements.map do |element| interpolator_for(element).call(state) end end
interpolator_for(element)
click to toggle source
# File lib/smartdown/engine/interpolator.rb, line 15 def interpolator_for(element) INTERPOLATOR_CONFIG.fetch(element.class, DEFAULT_INTERPOLATOR).new(element) end