class Troy::EmbeddedRuby

Attributes

content[R]

The template content.

data[R]

The data that must be rendered within the Troy::Context object.

Public Class Methods

new(content, data) click to toggle source
# File lib/troy/embedded_ruby.rb, line 14
def initialize(content, data)
  @content = content
  @data = data
end

Public Instance Methods

context() click to toggle source
# File lib/troy/embedded_ruby.rb, line 19
def context
  @context ||= Context.new(data).extend(Helpers)
end
render() click to toggle source
# File lib/troy/embedded_ruby.rb, line 23
def render
  ERB.new(content).result context.to_binding
end