Sha256: 25566e82b107a33aa1a7136f6a0f6ef220d471838daa97bf9d625a218c9cb0fa

Contents?: true

Size: 395 Bytes

Versions: 27

Compression:

Stored size: 395 Bytes

Contents

module ErbMacros
  def self.included(base)
    base.send :extend, ClassMethods
    base.send :include, InstanceMethods
  end

  module ClassMethods
  end
  
  module InstanceMethods
    def render_template(template)
      erb = ERB.new(template.read)
      tmp_file = Tempfile.new("erb")
      File.open(tmp_file.path, "wb") { |f| f.write(erb.result(binding)) } 
      tmp_file
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
fume-0.8.1a rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.8.0 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.8.0b rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.8.0a rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.7.2 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.7.1 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.7.0 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.6.7 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.6.6 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.6.4 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.6.3 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.6.2 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.6.1 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.6.0 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.5.3 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.5.2 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.5.1 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.5.0 rails_generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.4.3 generators/fume/rspec/templates/spec/support/erb_macros.rb
fume-0.4.2 generators/fume/rspec/templates/spec/support/erb_macros.rb