Method: Extractor#extract

Defined in:
lib/src/extractor.rb

#extract(node) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/src/extractor.rb', line 190

def extract(node)
  base, parent, tag, link, attribute = NodeParamsExtractor.new(node).extract
  path = PathBuilder.new(base: base, parent: parent, tag: tag).build

  if link.present?
    link_path = PathBuilder.new(base: base, parent: parent, tag: link).build

    if tag.is_a? Array
      tag = tag.map { |tag_path| replace_link(tag_path, link_path) }
    else
      path = replace_link(path, link_path)
    end
  end

  value = path_value(path, tag, attribute)
  format_value(value, node.props)
end