Module: XMLable::Mixins::ContentStorage
- Defined in:
- lib/xmlable/mixins/content_storage.rb
Overview
ContentStorage module contains the logic that helps to store XML element
content.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#__content ⇒ Object
private
Get content value.
-
#__content=(val) ⇒ Object
private
Set content value.
-
#__content_method ⇒ String?
private
Get content alias method.
-
#__content_methods ⇒ Array<String>
private
Contents methods.
-
#__empty? ⇒ Boolean
private
Is this element?.
-
#__object ⇒ Object
private
Get content value.
-
#__overwrite_content(val) ⇒ Object
private
Override XML node content.
-
#__set_content(node) ⇒ Object
private
Set XML element content.
- #to_s ⇒ String
Class Method Details
.included(base) ⇒ Object
8 9 10 |
# File 'lib/xmlable/mixins/content_storage.rb', line 8 def self.included(base) base.send(:extend, ClassMethods) end |
Instance Method Details
#__content ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get content value
55 56 57 |
# File 'lib/xmlable/mixins/content_storage.rb', line 55 def __content @__content end |
#__content=(val) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set content value
68 69 70 |
# File 'lib/xmlable/mixins/content_storage.rb', line 68 def __content=(val) __overwrite_content(val) end |
#__content_method ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get content alias method
98 99 100 |
# File 'lib/xmlable/mixins/content_storage.rb', line 98 def __content_method self.class.__content_method end |
#__content_methods ⇒ Array<String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Contents methods
109 110 111 112 113 |
# File 'lib/xmlable/mixins/content_storage.rb', line 109 def __content_methods ret = ['__content'] ret << __content_method.to_s if __content_method ret end |
#__empty? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Is this element?
79 80 81 82 |
# File 'lib/xmlable/mixins/content_storage.rb', line 79 def __empty? return false unless super __empty(__content) end |
#__object ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get content value
44 45 46 |
# File 'lib/xmlable/mixins/content_storage.rb', line 44 def __object __content end |
#__overwrite_content(val) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override XML node content
31 32 33 34 35 |
# File 'lib/xmlable/mixins/content_storage.rb', line 31 def __overwrite_content(val) val = __cast(val) @__node.content = __export_to_xml(val) @__content = val end |
#__set_content(node) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Set XML element content
19 20 21 22 |
# File 'lib/xmlable/mixins/content_storage.rb', line 19 def __set_content(node) val = node.children.select(&:text?).map(&:content).join('').strip @__content = __cast(val) end |
#to_s ⇒ String
87 88 89 |
# File 'lib/xmlable/mixins/content_storage.rb', line 87 def to_s __content.to_s end |