Module: XMLMapping::ClassMethods

Defined in:
lib/xmlmapping.rb

Instance Method Summary collapse

Instance Method Details

#ensure(message, &block) ⇒ Object



160
161
# File 'lib/xmlmapping.rb', line 160

def ensure(message, &block)
end

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



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

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

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



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

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

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



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

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

#mappingsObject



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

def mappings
  @mappings || superclass.mappings 
end

#namespace(namespace) ⇒ Object



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

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

#raw_mappingsObject



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

def raw_mappings
  @raw_mappings || superclass.raw_mappings 
end

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



155
156
157
158
# File 'lib/xmlmapping.rb', line 155

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