class Captify::TemplateBundle
Public Class Methods
find_base_path(caller_file_path, root="/")
click to toggle source
# File lib/captify/template_bundle.rb, line 15 def self.find_base_path(caller_file_path, root="/") base_path = File.dirname(File.expand_path(caller_file_path)) default_base_path = base_path while base_path && File.directory?(base_path) && !File.exist?(File.join(base_path,'lib')) parent = File.dirname base_path if parent == root base_path = default_base_path break end base_path = parent end return base_path end
find_templates_path(caller_file_path, root="/")
click to toggle source
# File lib/captify/template_bundle.rb, line 10 def self.find_templates_path(caller_file_path, root="/") base_path = find_base_path(caller_file_path, root) File.join(base_path, 'templates') end
register()
click to toggle source
# File lib/captify/template_bundle.rb, line 5 def self.register templates_path = find_templates_path(file_path(Kernel.caller.first)) TemplateRegistrar.instance.register_templates_in_dir templates_path end
Private Class Methods
file_path(call_stack_item)
click to toggle source
# File lib/captify/template_bundle.rb, line 33 def self.file_path(call_stack_item) extract_file = /^[^:]+/ File.expand_path call_stack_item[extract_file] end