class RGovData::Template
This is a convenience class for accessing disk-based template files It avoids pathname processing from being required where template are used
Public Class Methods
get(name, realm = nil)
click to toggle source
Returns the template file content name
is the filename realm
if specified is the subdirectory
# File lib/rgovdata/data/template.rb, line 21 def get(name, realm = nil) IO.read(path(name, realm)) rescue nil end
path(name, realm = nil)
click to toggle source
Returns the template file path name
is the filename realm
if specified is the subdirectory
# File lib/rgovdata/data/template.rb, line 11 def path(name, realm = nil) extra_path = [realm,name].compact.map(&:to_s) Pathname.new(File.dirname(__FILE__)).join(*extra_path).to_s rescue nil end