Class: XMLable::Handlers::Attribute

Inherits:
Base
  • Object
show all
Includes:
Mixins::Described, Mixins::Namespace, Mixins::Tag
Defined in:
lib/xmlable/handlers/attribute.rb

Overview

Attribute handles XML attributes objects

Direct Known Subclasses

AttributeNone

Instance Attribute Summary

Attributes inherited from Base

#block, #type

Instance Method Summary collapse

Methods inherited from Base

#block_settings?, build, #initialize, #method_name, #options, #options?, #type_class, #wrapped_type?

Constructor Details

This class inherits a constructor from XMLable::Handlers::Base

Instance Method Details

#from_xml_attribute(attribute) ⇒ XMLable::Mixins::Object

Create attribute object from the XML attribute

Parameters:

  • attribute (Nokogiri::XML::Attr)

Returns:



36
37
38
# File 'lib/xmlable/handlers/attribute.rb', line 36

def from_xml_attribute(attribute)
  Builder.build_attribute(attribute, self)
end

#inject_wraped(klass) ⇒ Object

See Also:

  • XMLable::Handler::Base#inject_class


14
15
16
17
18
19
20
# File 'lib/xmlable/handlers/attribute.rb', line 14

def inject_wraped(klass)
  klass.class_eval do
    include XMLable::Mixins::ValueStorage
    include XMLable::Mixins::Instantiable
  end
  klass
end

#proxyObject

See Also:

  • XMLable::Handler::Base#proxy


25
26
27
# File 'lib/xmlable/handlers/attribute.rb', line 25

def proxy
  @proxy ||= type_class.tap { |a| a.class_eval(&@block) if block_settings?  }
end