Class: EmbeddableContent::EmbeddedTags

Inherits:
Object
  • Object
show all
Defined in:
app/services/embeddable_content/embedded_tags.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record, attr, embedded_models) ⇒ EmbeddedTags

Returns a new instance of EmbeddedTags.



5
6
7
8
9
# File 'app/services/embeddable_content/embedded_tags.rb', line 5

def initialize(record, attr, embedded_models)
  @record          = record
  @attr            = attr
  @embedded_models = embedded_models
end

Instance Attribute Details

#attrObject (readonly)

Returns the value of attribute attr.



3
4
5
# File 'app/services/embeddable_content/embedded_tags.rb', line 3

def attr
  @attr
end

#embedded_modelsObject (readonly)

Returns the value of attribute embedded_models.



3
4
5
# File 'app/services/embeddable_content/embedded_tags.rb', line 3

def embedded_models
  @embedded_models
end

#recordObject (readonly)

Returns the value of attribute record.



3
4
5
# File 'app/services/embeddable_content/embedded_tags.rb', line 3

def record
  @record
end

Instance Method Details

#eachObject



11
12
13
14
15
16
17
18
# File 'app/services/embeddable_content/embedded_tags.rb', line 11

def each
  embedded_models.each do |model|
    document.css(model.embeddable_tag_name).each do |dom_node|
      info = EmbeddedTagInfo.new record, model, attr, dom_node
      yield info if info.available?
    end
  end
end