Sha256: dcf8671cf3aa42fe94ac61633f3e0ca36ac0f4306fbb4b42dedb582b77a41228

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

# = Template
#
# A simple templating mechanism.
#
# code:
# George Moschovitis  <gm@navel.gr>
#
# (c) 2004 Navel, all rights reserved.
# $Id$

module N;

# = Template
#
class Template
	attr_accessor :body
	
	#
	#
	def initialize(filename)
		@body = File.read(filename)
	end
	
	# Apply the substitutions to the template.
	#
	def gsub(hash)
		res = body.dup()
		
		hash.each {|k, v|
			res.gsub!(k, v)
		}
		
		return res
	end
	alias_method :render, :gsub
end

end # module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.1.2 lib/n/utils/template.rb