Sha256: 81edcd1cce29fbd99c19febb8da75f60d2bca1f21da15708993e684f428c5ec9
Contents?: true
Size: 724 Bytes
Versions: 2
Compression:
Stored size: 724 Bytes
Contents
module Happy module Extras class Scriptable < Happy::Controller def route run_script 'permissions.rb' run_script 'route.rb' end def run_script(name) instance_exec &get_proc_for_script(name) end def get_proc_for_script(name) if reload_script?(name) procs[name] = eval "lambda { %s }" % load_script(name) end procs[name] end def reload_script?(name) !procs[name] || Happy.env.development? end def load_script(name) file_name = File.expand_path(File.join(options[:directory], name)) File.read(file_name) end def procs @procs ||= {} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
happy-0.1.0.pre25 | lib/happy/extras/scriptable.rb |
happy-0.1.0.pre24 | lib/happy/extras/scriptable.rb |