class Idcf::Cli::Lib::Util::Template
template
Public Instance Methods
fetch(path, attr = {})
click to toggle source
return string
@param path [String] @param attr
# File lib/idcf/cli/lib/util/template.rb, line 17 def fetch(path, attr = {}) tmp_path = "#{Idcf::Cli::Conf::Const::TEMPLATE_DIR}/#{path}" attr.each do |k, v| set(k, v) end f_content = File.open(File.expand_path(tmp_path)).read ERB.new(f_content).result(binding) end
set(name, value)
click to toggle source
# File lib/idcf/cli/lib/util/template.rb, line 9 def set(name, value) instance_variable_set("@#{name}", value) end