Method: XSD::BaseObject#collect_attributes

Defined in:
lib/xsd/base_object.rb

#collect_attributesObject

Get all available attributes on the current stack level



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/xsd/base_object.rb', line 237

def collect_attributes(*)
  return @collect_attributes if @collect_attributes

  r = if NO_ATTRIBUTES_CONTAINER.include?(self.class.mapped_name)
        []
      elsif is_a?(Referenced) && ref
        reference.collect_attributes
      else
        # map children recursive
        map_children(:*).map do |obj|
          if obj.is_a?(Attribute) || obj.is_a?(AnyAttribute)
            obj
          else
            # get attributes considering references
            (obj.is_a?(Referenced) && obj.ref ? obj.reference : obj).collect_attributes
          end
        end.flatten
      end

  @collect_attributes = r
end