lib/xsd_reader/element.rb in xsd-reader-0.0.1 vs lib/xsd_reader/element.rb in xsd-reader-0.1.0
- old
+ new
@@ -8,15 +8,15 @@
return super if opts[:direct] == true
all_elements
end
def attributes
- super + (complex_type ? complex_type.attributes : [])
+ @_element_attributes ||= super + (complex_type ? complex_type.attributes : [])
end
def complex_type
- super || linked_complex_type
+ @_element_complex_type ||= super || linked_complex_type
end
def min_occurs
node.attributes['minOccurs'] ? node.attributes['minOccurs'].value.to_i : nil
end
@@ -35,13 +35,9 @@
min_occurs.nil? || min_occurs.to_i > 0 # TODO; consider if the element is part of a choice definition?
end
def optional?
!required?
- end
-
- def parent
- node.parent
end
def family_tree(stack = [])
logger.warn('Usage of the family tree function is not recommended as it can take very long to execute and is very memory intensive')
return @_cached_family_tree if @_cached_family_tree
\ No newline at end of file