Class: EmbeddableContent::TemplateManager
Constant Summary
collapse
- DEFAULT_NUM_BACKTRACE_LINES =
10
- NUM_BACKTRACE_LINES =
ENV.fetch('NUM_BACKTRACE_LINES', DEFAULT_NUM_BACKTRACE_LINES).try :to_i
Instance Attribute Summary collapse
Attributes inherited from EmbedderBase
#config, #options
Instance Method Summary
collapse
default_s3_bucket, #ed_node, #locale, #s3_bucket, #target, #to_s, #tree, #tree_node
Constructor Details
Returns a new instance of TemplateManager.
13
14
15
16
|
# File 'app/services/embeddable_content/template_manager.rb', line 13
def initialize(node_processor)
@node_processor = node_processor
super node_processor.config, node_processor.options
end
|
Instance Attribute Details
#node_processor ⇒ Object
Returns the value of attribute node_processor.
7
8
9
|
# File 'app/services/embeddable_content/template_manager.rb', line 7
def node_processor
@node_processor
end
|
Instance Method Details
#node_attrs ⇒ Object
28
29
30
31
|
# File 'app/services/embeddable_content/template_manager.rb', line 28
def node_attrs
@node_attrs ||= { class: node_classes,
data: node_data }.compact
end
|
#node_id ⇒ Object
37
38
39
40
41
|
# File 'app/services/embeddable_content/template_manager.rb', line 37
def node_id
return if record.nil?
"#{record_model}-#{record.id}-#{node_index}"
end
|
#selected_backtrace_lines ⇒ Object
22
23
24
25
26
|
# File 'app/services/embeddable_content/template_manager.rb', line 22
def selected_backtrace_lines
return if error.nil?
error.backtrace.first(NUM_BACKTRACE_LINES).join "\n"
end
|
#target_attrs ⇒ Object
33
34
35
|
# File 'app/services/embeddable_content/template_manager.rb', line 33
def target_attrs
@target_attrs ||= { id: node_id }.compact
end
|
#warning_node ⇒ Object
18
19
20
|
# File 'app/services/embeddable_content/template_manager.rb', line 18
def warning_node
render_path warning_node_path
end
|