Method: WSDSL::Response::Element#attribute
- Defined in:
- lib/response.rb
#attribute(opts, extra_opts = {}) ⇒ Array<WSDSL::Response::Attribute>
sets a new attribute and returns the entire list of attributes
176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/response.rb', line 176 def attribute(opts, extra_opts={}) raise ArgumentError unless opts.is_a?(Hash) && extra_opts.is_a?(Hash) new_attribute = Attribute.new(opts, extra_opts) @attributes << new_attribute # document the attribute if description available # we might want to have a placeholder message when a response attribute isn't defined if opts.merge!(extra_opts).has_key?(:doc) @doc.attribute(new_attribute.name, opts[:doc]) end @attributes end |