Class: Confinement::Renderer::Erb

Inherits:
Object
  • Object
show all
Defined in:
lib/confinement.rb

Instance Method Summary collapse

Instance Method Details

#call(source, view_context, path:, &block) ⇒ Object



496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/confinement.rb', line 496

def call(source, view_context, path:, &block)
  method_name =
    if path
      "_#{Digest::MD5.hexdigest(source)}__#{path.to_s.tr("^A-Za-z", "_")}"
    else
      "_#{Digest::MD5.hexdigest(source)}"
    end

  compile(method_name, source, view_context, path: path)

  view_context.public_send(method_name, &block)
end