class DocumentBuilder::Tag

Attributes

name[R]
node[R]
selector[R]
type[R]

Public Class Methods

new(name, type: nil, selector: nil) click to toggle source
# File lib/document_builder/tag.rb, line 5
def initialize(name, type: nil, selector: nil)
  @name = name
  @selector = selector
  @type = type || Coercion::TextProperty
end

Public Instance Methods

call(document) click to toggle source
# File lib/document_builder/tag.rb, line 11
def call(document)
  return nil if document.nil?

  @node = selector.nil? ? document : document.attributes[selector]
  type.call(@node)
end