Class: EndERB

Inherits:
Object show all
Defined in:
lib/end_erb.rb

Class Method Summary collapse

Class Method Details

.apply(hash) ⇒ Object

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@


33
34
35
# File 'lib/end_erb.rb', line 33

def apply(hash)
  ERB.new(DATA.read).result(binding)
end