Module: VagrantPlugins::ProviderLibvirt::Util::ErbTemplate
- Included in:
- Action::CreateDomain, Action::CreateDomainVolume, Action::CreateNetworkInterfaces, Action::CreateNetworks, Action::HandleStoragePool, SyncedFolder9p::SyncedFolder
- Defined in:
- lib/vagrant-libvirt/util/erb_template.rb
Instance Method Summary collapse
-
#to_xml(template_name = nil, data = binding) ⇒ Object
TODO: remove and use nokogiri builder TODO: might be a chance to use vagrant template system according to github.com/mitchellh/vagrant/issues/3231.
Instance Method Details
#to_xml(template_name = nil, data = binding) ⇒ Object
TODO: remove and use nokogiri builder TODO: might be a chance to use vagrant template system according to github.com/mitchellh/vagrant/issues/3231
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/vagrant-libvirt/util/erb_template.rb', line 9 def to_xml(template_name = nil, data = binding) erb = template_name || self.class.to_s.split('::').last.downcase path = File.join(File.dirname(__FILE__), '..', 'templates', "#{erb}.xml.erb") template = File.read(path) # TODO: according to erubis documentation, we should rather use evaluate and forget about # binding since the template may then change variables values Erubis::Eruby.new(template, trim: true).result(data) end |