lib/cim/qualifier.rb in cim-0.5.0 vs lib/cim/qualifier.rb in cim-1.3
- old
+ new
@@ -13,10 +13,14 @@
# a Property, a Method or a parameter.
#
# Qualifier can be seen as an instance of QualifierDeclaration
#
class Qualifier
+ def self.normalize type
+ (type.is_a? self) ? type : self.new(type)
+ end
+
attr_reader :declaration, :value, :flavor
#
# call-seq:
# Qualifier.new qualifier_declaration
# Qualifier.new qualifier_declaration, value
@@ -71,11 +75,11 @@
# returns a string representation in MOF syntax format
#
def to_s
s = "#{@declaration.name.capitalize}"
case @value
- when nil:
- when Array:
+ when nil
+ when Array
s << " {#{@value.join(', ')}}"
else
s << "(#{@value.inspect})"
end
s << " #{@flavor}" if @flavor