diff options
Diffstat (limited to 'lib/xsd/namedelements.rb')
-rw-r--r-- | lib/xsd/namedelements.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/xsd/namedelements.rb b/lib/xsd/namedelements.rb index f4d7c4f5aa..a13396bb71 100644 --- a/lib/xsd/namedelements.rb +++ b/lib/xsd/namedelements.rb @@ -1,5 +1,5 @@ # XSD4R - WSDL named element collection. -# Copyright (C) 2002, 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. +# Copyright (C) 2002, 2003, 2005 NAKAMURA, Hiroshi <nahi@ruby-lang.org>. # This program is copyrighted free software by NAKAMURA, Hiroshi. You can # redistribute it and/or modify it under the same terms of Ruby's license; @@ -23,6 +23,12 @@ class NamedElements o end + def freeze + super + @elements.freeze + self + end + def empty? size == 0 end @@ -43,6 +49,10 @@ class NamedElements @elements.find { |item| item.name.name == name } end + def keys + collect { |element| element.name } + end + def each @elements.each do |element| yield(element) @@ -69,6 +79,8 @@ class NamedElements self end + Empty = NamedElements.new.freeze + protected def elements=(rhs) |