Sha256: 701abfa197a071f8f91244872e44c5867c32cf139d2c0cddc39e580fc97f1e25
Contents?: true
Size: 768 Bytes
Versions: 1
Compression:
Stored size: 768 Bytes
Contents
module RenderMePretty class Context def initialize(hash={}) # http://stackoverflow.com/questions/1338960/ruby-templates-how-to-pass-variables-into-inlined-erb hash.each do |key, value| instance_variable_set('@' + key.to_s, value) end end def override_variables!(vars) vars.each do |key, value| instance_variable_set('@' + key.to_s, value) end end def get_binding binding end def self.load_helpers(base_folder) Dir.glob("#{base_folder}/**/*_helper.rb").each do |path| relative_path = path.sub("#{base_folder}/", "") class_name = File.basename(relative_path, '.rb').classify require path include const_get(class_name) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
render_me_pretty-0.2.0 | lib/render_me_pretty/erb.rb |