2023-10-08 00:16:37 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-10-07 08:21:48 +02:00
|
|
|
module Mixin::ERB
|
2023-10-07 08:26:43 +02:00
|
|
|
def erb(path, local_assigns = {})
|
|
|
|
erb = File.binread File.join(Dir.getwd, "src", "html", path)
|
2023-10-07 08:21:48 +02:00
|
|
|
scope = binding
|
|
|
|
local_assigns.each { scope.local_variable_set(_1, _2) }
|
|
|
|
::ERB.new(erb).result(scope)
|
|
|
|
end
|
|
|
|
end
|