class AegisNet::Sitemapper::Loader
Public Class Methods
load_config()
click to toggle source
Loads the sitemap configuration from Rails.root/config/sitemap.yml
# File lib/sitemapper/loader.rb, line 13 def self.load_config # TODO verify file integrity erb = ERB.new(File.read(AegisNet::Sitemapper.sitemap_file)) AegisNet::Sitemapper.configuration ||= HashWithIndifferentAccess.new(YAML.load(StringIO.new(erb.result))) end
proc_loader(string, *args)
click to toggle source
Interprets string
as Ruby code representing a Proc and exectutes it.
Parameters¶ ↑
-
string
: Ruby (Proc) code to be executed
All other arguments will be passed to the Proc
Examples¶ ↑
AegisNet::Sitemapper::Loader.proc_loader('Proc.new{"foo"}') => "foo" proc_str = 'Proc.new{|n| n}' AegisNet::Sitemapper::Loader.proc_loader(proc_str, "hello world") => "hello world"
# File lib/sitemapper/loader.rb, line 32 def self.proc_loader(string, *args) # TODO lambdas eval(string).call(*args) end