Module: Lbrt::Utils::ContextHelper
- Included in:
- Alert::DSL::Context, Service::DSL::Context, Space::DSL::Context
- Defined in:
- lib/lbrt/utils.rb
Overview
of class methods
Instance Method Summary collapse
Instance Method Details
#require(file_orig) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lbrt/utils.rb', line 25 def require(file_orig) file = (file_orig =~ %r|\A/|) ? file_orig : File.(File.join(File.dirname(@path), file_orig)) if File.exist?(file) instance_eval(File.read(file), file) elsif File.exist?(file + '.rb') instance_eval(File.read(file + '.rb'), file + '.rb') else Kernel.require(file_orig) end end |
#template(name, &block) ⇒ Object
37 38 39 |
# File 'lib/lbrt/utils.rb', line 37 def template(name, &block) @context.templates[name.to_s] = block end |