Skip to content

Instantly share code, notes, and snippets.

@spheromak
Created November 28, 2009 04:07
Show Gist options
  • Save spheromak/244383 to your computer and use it in GitHub Desktop.
Save spheromak/244383 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'erubis'
input = "
<% @conf.each do |k, v| -%>
<%= k %>=<%= v %>
<% end -%>
"
eruby = Erubis::Eruby.new(input)
postfix = Hash.new
postfix["multi"] = {
"postfix" => {
"bind_address" => "127.0.0.1",
"deadbeats_concurancy_limit" => "20",
"hash_queue_depth" => 3,
"in_flow_delay" => "5s"
},
"sysmail" => {
"bind_address" => "127.0.0.1",
"deadbeats_concurancy_limit" => "20",
"hash_queue_depth" => 3,
"in_flow_delay" => "5s"
}
}
puts "---------- script source ---"
puts eruby.src
postconf = Hash.new
postfix["multi"].each do |k, v|
postconf = postfix["multi"][k]
puts "postconf is a #{postconf.class}"
puts "---------- result ----------"
puts eruby.evaluate( :conf => postconf )
postconf.clear
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment