module Erb::View
Constants
- VERSION
Public Class Methods
included(base)
click to toggle source
# File lib/erb/view.rb, line 16 def self.included(base) base.extend(ClassMethods) end
new()
click to toggle source
# File lib/erb/view.rb, line 40 def initialize self.class.exposes.each do |method| next if respond_to?(method) define_singleton_method(method) do @data.fetch(method) end end end
Public Instance Methods
render(data = {})
click to toggle source
# File lib/erb/view.rb, line 49 def render(data = {}) @data = data erb(self.class.template.to_s).result(binding) end
Private Instance Methods
erb(template)
click to toggle source
# File lib/erb/view.rb, line 56 def erb(template) ERB.new(File.read(root.join("#{template}.erb"))) end
root()
click to toggle source
# File lib/erb/view.rb, line 60 def root Erb.root end