class News::Template
Public Class Methods
new( text )
click to toggle source
# File lib/newscast.rb, line 300 def initialize( text ) @template = ERB.new( text ) end
Public Instance Methods
render( **kwargs )
click to toggle source
todo: use locals / assigns or something instead of **kwargs - why? why not?
allow/support (extra) locals / assigns - why? why not?
# File lib/newscast.rb, line 306 def render( **kwargs ) ## note: Ruby >= 2.5 has ERB#result_with_hash - use later - why? why not? @template.result( Context.new( **kwargs ).get_binding ) end