Method: CoreLibrary::XmlHelper.from_attribute

Defined in:
lib/apimatic-core/utilities/xml_helper.rb

.from_attribute(parent, name, clazz, datetime_format: nil) ⇒ Object

Converts attribute to a specific class.

Parameters:

  • parent (String)

    Parent XML.

  • name (String)

    Attribute name.

  • clazz (Class)

    Attribute class.

  • datetime_format (CoreLibrary::DateTimeFormat) (defaults to: nil)

    Datetime format to use for conversion..



176
177
178
179
180
181
# File 'lib/apimatic-core/utilities/xml_helper.rb', line 176

def from_attribute(parent, name, clazz, datetime_format: nil)
  attribute = parent[name]
  return nil if attribute.nil?

  convert(attribute, clazz, datetime_format)
end