Sha256: 4726a4bc0486ccd2c14dc28a01c5fbc833c0679f795841b51c3890f1a6e0b70a
Contents?: true
Size: 760 Bytes
Versions: 4
Compression:
Stored size: 760 Bytes
Contents
require 'happy/extras/permissions' 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
4 entries across 4 versions & 1 rubygems