lib/cim/qualifier_set.rb in cim-0.5.0 vs lib/cim/qualifier_set.rb in cim-1.3

- old
+ new

@@ -10,21 +10,28 @@ module CIM # # Set of Qualifier # class QualifierSet < ::Array + def self.normalize type + (type.is_a? self) ? type : self.new(type) + end + + def initialize *args super 0 args.flatten.each do |q| case q - when QualifierDeclaration: q = Qualifier.new q - when Qualifier: + when QualifierDeclaration + q = Qualifier.new q + when Qualifier + # nothing else q = Qualifier.new(QualifierDeclaration.new q) end self << q - end + end if args end # # check if qualifier exists # # call-seq: @@ -49,12 +56,10 @@ return q if case qualifier when CIM::Qualifier q == qualifier.declaration when CIM::QualifierDeclaration q == qualifier - when String - q.declaration == qualifier - when Symbol + when String, Symbol q.declaration == qualifier else raise "Unknown parameter in #{self.class}[]" end end