Module: Base4R::AdditionalXmlAttributeMethods
- Included in:
- Attribute
- Defined in:
- lib/attribute.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
36 37 38 |
# File 'lib/attribute.rb', line 36 def self.included(base) base.send :extend, ClassMethods end |
Instance Method Details
#additional_xml_attribute_map ⇒ Object
48 49 50 51 52 53 |
# File 'lib/attribute.rb', line 48 def additional_xml_attribute_map self.class.xml_attributes.merge(xml_attributes||{}).inject({}) do |map, (k,v)| map[k] = xml_attribute_value(v) map end end |
#xml_attribute_value(v) ⇒ Object
55 56 57 |
# File 'lib/attribute.rb', line 55 def xml_attribute_value(v) v.is_a?(Proc) ? v.call(self) : v.to_s end |
#xml_attributes ⇒ Object
59 |
# File 'lib/attribute.rb', line 59 def xml_attributes; [:xml_attributes]||{}; end |