Sha256: c946abad7f16e2e39deae18cfbf005d7bd67f30d0c6e3d42f551003c997ddc3d

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

require 'xsd_model/xsdize'

module XsdModel
  module Elements
    module AttributeMethods
      using Xsdize

      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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xsd_model-0.7.0 lib/xsd_model/elements/attribute_methods.rb
xsd_model-0.6.0 lib/xsd_model/elements/attribute_methods.rb
xsd_model-0.5.0 lib/xsd_model/elements/attribute_methods.rb