Module: Primer::Forms::ActsAsComponent
Overview
Defined Under Namespace
Modules: InstanceMethods
Classes: TemplateGlob, TemplateParams
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.extended(base) ⇒ Object
35
36
37
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 35
def self.extended(base)
base.include(InstanceMethods)
end
|
Instance Method Details
#base_template_path ⇒ Object
68
69
70
71
72
73
74
75
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 68
def base_template_path
return @base_template_path if defined?(@base_template_path)
base_path = Utils.const_source_location(self.name)
if base_path
@base_template_path = File.dirname(base_path)
end
end
|
#compile! ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 47
def compile!
return if defined?(@compiled) && @compiled && !Rails.env.development?
template_globs.each do |template_glob|
compile_templates_in(template_glob)
end
@compiled = true
end
|
#renders_templates(glob_pattern, method_name = nil, &block) ⇒ Object
Also known as:
renders_template
42
43
44
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 42
def renders_templates(glob_pattern, method_name = nil, &block)
template_globs << TemplateGlob.new(glob_pattern, method_name, block)
end
|
#template_root_path ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'app/lib/primer/forms/acts_as_component.rb', line 58
def template_root_path
return @template_root_path if defined?(@template_root_path)
form_path = Utils.const_source_location(self.name)
@template_root_path =
if form_path
File.join(File.dirname(form_path), self.name.demodulize.underscore)
end
end
|