Class: DocumentBuilder::ElementAttribute

Inherits:
Object
  • Object
show all
Includes:
Coercion
Defined in:
lib/document_builder/coercion.rb

Class Method Summary collapse

Methods included from Coercion

included

Class Method Details

.call(document, params = {}) ⇒ Object



59
60
61
62
# File 'lib/document_builder/coercion.rb', line 59

def self.call(document, params = {})
  element = document.attributes[params[:xpath].to_s]
  element.nil? ? nil : self.coerce(element)
end

.coerce(document) ⇒ Object



64
65
66
# File 'lib/document_builder/coercion.rb', line 64

def self.coerce(document)
  document.value
end