Module: XMLable::Mixins::AttributesStorage::ClassMethods

Defined in:
lib/xmlable/mixins/attributes_storage.rb

Instance Method Summary collapse

Instance Method Details

#__attributes_handlersXMLable::Handlers::Storage

Attributes handlers storage



172
173
174
175
# File 'lib/xmlable/mixins/attributes_storage.rb', line 172

def __attributes_handlers
  @__attributes_handlers ||=
    __nested(:@__attributes_handlers) || Handlers::Storage.new(default: Handlers::AttributeNone)
end

#attribute(*args, &block) ⇒ XMLable::Handlers::Storage

Describe object attribute

Returns:

See Also:

  • Handler::Base#build


184
185
186
187
188
189
190
191
# File 'lib/xmlable/mixins/attributes_storage.rb', line 184

def attribute(*args, &block)
  opts = args.last.is_a?(Hash) ? args.pop : {}
  if __default_namespace && !opts.key?(:namespace)
    opts[:namespace] = __default_namespace
  end
  h = Handlers::Attribute.build(*args, opts, &block)
  __attributes_handlers << h
end