Module: XMLMapping::ClassMethods
- Defined in:
- lib/xmlmapping.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#default_namespace ⇒ Object
readonly
Returns the value of attribute default_namespace.
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
-
#text_attribute ⇒ Object
readonly
Returns the value of attribute text_attribute.
Instance Method Summary collapse
- #has_attribute(attribute, options = {}) ⇒ Object
- #has_many(attribute, options = {}) ⇒ Object
- #has_one(attribute, options = {}) ⇒ Object
- #namespace(namespace) ⇒ Object
- #text(attribute, options = {}) ⇒ Object
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
111 112 113 |
# File 'lib/xmlmapping.rb', line 111 def attributes @attributes end |
#default_namespace ⇒ Object (readonly)
Returns the value of attribute default_namespace.
114 115 116 |
# File 'lib/xmlmapping.rb', line 114 def default_namespace @default_namespace end |
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
112 113 114 |
# File 'lib/xmlmapping.rb', line 112 def elements @elements end |
#text_attribute ⇒ Object (readonly)
Returns the value of attribute text_attribute.
113 114 115 |
# File 'lib/xmlmapping.rb', line 113 def text_attribute @text_attribute end |
Instance Method Details
#has_attribute(attribute, options = {}) ⇒ Object
146 147 148 149 |
# File 'lib/xmlmapping.rb', line 146 def has_attribute(attribute, = {}) attr attribute @attributes[attribute] = end |
#has_many(attribute, options = {}) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/xmlmapping.rb', line 133 def has_many(attribute, = {}) attr attribute [:cardinality] = :many [:attribute] = attribute name = attribute if .has_key? :name name = [:name].to_sym end @elements[name] = end |
#has_one(attribute, options = {}) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/xmlmapping.rb', line 120 def has_one(attribute, = {}) attr attribute [:cardinality] = :one [:attribute] = attribute name = attribute if .has_key? :name name = [:name].to_sym end @elements[name] = end |
#namespace(namespace) ⇒ Object
116 117 118 |
# File 'lib/xmlmapping.rb', line 116 def namespace(namespace) @default_namespace = namespace end |
#text(attribute, options = {}) ⇒ Object
151 152 153 154 |
# File 'lib/xmlmapping.rb', line 151 def text(attribute, = {}) attr attribute @text_attribute = [attribute, ] end |