class DocumentBuilder::Property
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/property.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/property.rb, line 11 def call(document) return nil if document.nil? if selector.nil? || document.name == selector @node = document else @node = document.at_xpath(selector) end type.call(@node) end