Module: XMLMapping::ClassMethods

Defined in:
lib/xmlmapping.rb

Instance Method Summary collapse

Instance Method Details

#has_attribute(attribute, options = {}) ⇒ Object



147
148
149
# File 'lib/xmlmapping.rb', line 147

def has_attribute(attribute, options = {})
	add(attribute, :attribute, options)
end

#has_many(attribute, options = {}) ⇒ Object



142
143
144
145
# File 'lib/xmlmapping.rb', line 142

def has_many(attribute, options = {})
	options[:cardinality] = :many
	add(attribute, :element, options)
end

#has_one(attribute, options = {}) ⇒ Object



137
138
139
140
# File 'lib/xmlmapping.rb', line 137

def has_one(attribute, options = {})
	options[:cardinality] = :one
	add(attribute, :element, options)
end

#mappingsObject



128
129
130
# File 'lib/xmlmapping.rb', line 128

def mappings
	@mappings || superclass.mappings 
end

#namespace(namespace) ⇒ Object



132
133
134
135
# File 'lib/xmlmapping.rb', line 132

def namespace(namespace)
	initialize_vars
	@mappings[:namespace] = namespace	
end

#raw_mappingsObject



124
125
126
# File 'lib/xmlmapping.rb', line 124

def raw_mappings
	@raw_mappings || superclass.raw_mappings 
end

#text(attribute, options = {}) ⇒ Object



151
152
153
154
# File 'lib/xmlmapping.rb', line 151

def text(attribute, options = {})
	options[:namespace] = :any
	add(attribute, :text, options)
end