module LazyXmlModel::AttributeNode

Public Class Methods

attribute_node(name) click to toggle source
# File lib/lazy_xml_model/attribute_node.rb, line 6
def self.attribute_node(name)
  # Getter Method
  define_method(name) do
    attribute = xml_element.attributes[name.to_s]
    return if attribute.nil?

    xml_element.attributes[name.to_s].value
  end

  # Setter Method
  define_method("#{name}=") do |value|
    xml_element.set_attribute(name.to_s, value)
  end
end