module XsdModel::Elements::AttributeMethods

Public Instance Methods

attribute_method(*attr_names) click to toggle source
# File lib/xsd_model/elements/attribute_methods.rb, line 8
def attribute_method(*attr_names)
  attr_names.each do |attr_name|
    define_method attr_name.underscore do
      attributes[attr_name.to_s]
    end

    define_method "has_#{attr_name.underscore}?" do
      !attributes[attr_name.to_s].nil?
    end

    define_method "no_#{attr_name.underscore}?" do
      attributes[attr_name.to_s].nil?
    end
  end
end