Class: EmbeddableContent::NodeProcessor

Inherits:
EmbedderBase show all
Defined in:
app/services/embeddable_content/node_processor.rb

Direct Known Subclasses

HtmlTags::NodeProcessor, RecordNodeProcessor

Constant Summary collapse

NODE_CAN_BE_REMOVED_BY_DEFAULT =
true
SELECTOR_CLASS_BLANK_BY_DEFAULT =
nil
RECORD_BLANK_BY_DEFAULT =
nil
ALL_TARGETS_PROCESSED_BY_DEFAULT =
EmbedderConfig::ALL_TARGETS
DEFAULT_TEMPLATE_MANAGER_CLASS =
TemplateManager
ADDED_CLASSES_BLANK_BY_DEFAULT =
[].freeze

Instance Attribute Summary collapse

Attributes inherited from EmbedderBase

#config, #options

Instance Method Summary collapse

Methods inherited from EmbedderBase

default_s3_bucket, #ed_node, #locale, #s3_bucket, #target, #to_s, #tree, #tree_node

Constructor Details

#initialize(doc_processor, node, node_index) ⇒ NodeProcessor

Returns a new instance of NodeProcessor.



15
16
17
18
19
20
# File 'app/services/embeddable_content/node_processor.rb', line 15

def initialize(doc_processor, node, node_index)
  @doc_processor  = doc_processor
  @node           = node
  @node_index     = node_index
  super embedder.config, embedder.options
end

Instance Attribute Details

#doc_processorObject (readonly)

Returns the value of attribute doc_processor.



10
11
12
# File 'app/services/embeddable_content/node_processor.rb', line 10

def doc_processor
  @doc_processor
end

#errorObject (readonly)

Returns the value of attribute error.



10
11
12
# File 'app/services/embeddable_content/node_processor.rb', line 10

def error
  @error
end

#nodeObject (readonly)

Returns the value of attribute node.



10
11
12
# File 'app/services/embeddable_content/node_processor.rb', line 10

def node
  @node
end

#node_indexObject (readonly)

Returns the value of attribute node_index.



10
11
12
# File 'app/services/embeddable_content/node_processor.rb', line 10

def node_index
  @node_index
end

Instance Method Details

#node_added_classesObject



33
34
35
# File 'app/services/embeddable_content/node_processor.rb', line 33

def node_added_classes
  ADDED_CLASSES_BLANK_BY_DEFAULT
end

#node_selector_classObject



29
30
31
# File 'app/services/embeddable_content/node_processor.rb', line 29

def node_selector_class
  SELECTOR_CLASS_BLANK_BY_DEFAULT
end

#process!Object



22
23
24
25
26
27
# File 'app/services/embeddable_content/node_processor.rb', line 22

def process!
  process_node || remove_node
rescue StandardError => e
  @error = e
  node.replace warning_node
end

#recordObject



37
38
39
# File 'app/services/embeddable_content/node_processor.rb', line 37

def record
  RECORD_BLANK_BY_DEFAULT
end