class EndERB

Public Class Methods

apply(hash) click to toggle source

for single template script using __END__ and DATA

Params

  • :hash - erb template variable hash

Example

def hoge
  hash = {
    hoge: '@hoge@',
    hige: '@hige@',
  }
  EndERB.apply(hash)
end

puts hoge

__END__

output

hoge=@hoge@
hige=@hige@
# File lib/end_erb.rb, line 33
def apply(hash)
  ERB.new(DATA.read).result(binding)
end