Class: EmbeddableContent::Embedder

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

Constant Summary collapse

NO_REPLACEMENTS_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(target, options = {}) ⇒ Embedder

Returns a new instance of Embedder.



7
8
9
# File 'app/services/embeddable_content/embedder.rb', line 7

def initialize(target, options = {})
  super EmbedderConfig.for_target(target), options
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



5
6
7
# File 'app/services/embeddable_content/embedder.rb', line 5

def document
  @document
end

#htmlObject (readonly)

Returns the value of attribute html.



5
6
7
# File 'app/services/embeddable_content/embedder.rb', line 5

def html
  @html
end

Instance Method Details

#embed_content!(content) ⇒ Object



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

def embed_content!(content)
  @html = content.to_str.dup
  @document = scrub parse_html
  perform_replacements
  run_doc_processors
  write_embedded_html_to_tmp_file if debug_embedder?
  @html
end

#image_catalogObject



11
12
13
# File 'app/services/embeddable_content/embedder.rb', line 11

def image_catalog
  @image_catalog ||= Set.new
end

#rebuild_documentObject



24
25
26
# File 'app/services/embeddable_content/embedder.rb', line 24

def rebuild_document
  @document = parse_html
end