cim 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/lib/cim.rb +4 -1
 - data/lib/cim/type.rb +5 -1
 - data/lib/cim/variant.rb +36 -7
 - metadata +25 -34
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fc7b0bda547a22d0f754c96dae011b9f2591cad8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e567befe6c52d503590b06a5ec186930f280e3cc
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ddff66a1228b09f5c1b7df502d3261375e711458ccb2db664b15813999751d3e2308a55337097d70cd9e16936ddfec04bfd0179b5d8a1d212a0a4c7dd438d41f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4010529e49f4d2f0676b1d9de7b92ed95b52d43c0f92db7c6a7c404fecd09d5cf84104031a725dca38994edff5fc739628461b23c8b24b9e0c09be9630aed56f
         
     | 
    
        data/lib/cim.rb
    CHANGED
    
    | 
         @@ -10,6 +10,9 @@ 
     | 
|
| 
       10 
10 
     | 
    
         
             
            $:.unshift(File.dirname(__FILE__)) unless
         
     | 
| 
       11 
11 
     | 
    
         
             
              $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
      
 13 
     | 
    
         
            +
            CIMPATH = "/usr/share/mof/ruby"
         
     | 
| 
      
 14 
     | 
    
         
            +
            $:.unshift(CIMPATH) unless $:.include?(CIMPATH)
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       13 
16 
     | 
    
         
             
            #
         
     | 
| 
       14 
17 
     | 
    
         
             
            # The CIM Ruby gem is an implementation of the Common Information Model (CIM) meta schema[1]
         
     | 
| 
       15 
18 
     | 
    
         
             
            #
         
     | 
| 
         @@ -41,7 +44,7 @@ $:.unshift(File.dirname(__FILE__)) unless 
     | 
|
| 
       41 
44 
     | 
    
         
             
            #
         
     | 
| 
       42 
45 
     | 
    
         | 
| 
       43 
46 
     | 
    
         
             
            module CIM
         
     | 
| 
       44 
     | 
    
         
            -
              VERSION = '1.4. 
     | 
| 
      
 47 
     | 
    
         
            +
              VERSION = '1.4.2'
         
     | 
| 
       45 
48 
     | 
    
         
             
              require 'cim/type'
         
     | 
| 
       46 
49 
     | 
    
         
             
              require 'cim/variant'
         
     | 
| 
       47 
50 
     | 
    
         
             
              require 'cim/qualifier_flavors'
         
     | 
    
        data/lib/cim/type.rb
    CHANGED
    
    | 
         @@ -152,12 +152,16 @@ module CIM 
     | 
|
| 
       152 
152 
     | 
    
         
             
                # check if another Type or Variant matches
         
     | 
| 
       153 
153 
     | 
    
         
             
                #
         
     | 
| 
       154 
154 
     | 
    
         
             
                def matches? x
         
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
      
 155 
     | 
    
         
            +
            #      	puts "Type#matches? : >#{self}<{#{self.class}}.matches?>#{x.inspect}<{#{x.class}}"
         
     | 
| 
       156 
156 
     | 
    
         
             
                  case x
         
     | 
| 
       157 
157 
     | 
    
         
             
                  when CIM::Type, CIM::Variant
         
     | 
| 
       158 
158 
     | 
    
         
             
            	return true if x.type == @type
         
     | 
| 
       159 
159 
     | 
    
         
             
            	return true if MATCHES[@type].include? x.type
         
     | 
| 
       160 
160 
     | 
    
         
             
            	false
         
     | 
| 
      
 161 
     | 
    
         
            +
                  when ::Symbol
         
     | 
| 
      
 162 
     | 
    
         
            +
                    return true if @type == x
         
     | 
| 
      
 163 
     | 
    
         
            +
                    return true if MATCHES[@type].include? x
         
     | 
| 
      
 164 
     | 
    
         
            +
                    false
         
     | 
| 
       161 
165 
     | 
    
         
             
                  when ::Array
         
     | 
| 
       162 
166 
     | 
    
         
             
            	return false unless self.is_a? CIM::Array
         
     | 
| 
       163 
167 
     | 
    
         
             
            	x.each do |v|
         
     | 
    
        data/lib/cim/variant.rb
    CHANGED
    
    | 
         @@ -30,19 +30,48 @@ module CIM 
     | 
|
| 
       30 
30 
     | 
    
         
             
                #
         
     | 
| 
       31 
31 
     | 
    
         
             
                def == v
         
     | 
| 
       32 
32 
     | 
    
         
             
            #      $stderr.puts "<#{@type}>#{self} == #{v.class}"
         
     | 
| 
      
 33 
     | 
    
         
            +
                  return false unless self.is_a?(v)
         
     | 
| 
       33 
34 
     | 
    
         
             
                  case v
         
     | 
| 
       34 
     | 
    
         
            -
                  when NilClass then     @ 
     | 
| 
       35 
     | 
    
         
            -
                  when FalseClass then    
     | 
| 
       36 
     | 
    
         
            -
                  when TrueClass then    @ 
     | 
| 
       37 
     | 
    
         
            -
                  when String then       @ 
     | 
| 
       38 
     | 
    
         
            -
                  when Integer then      @ 
     | 
| 
       39 
     | 
    
         
            -
                  when Float then        @ 
     | 
| 
       40 
     | 
    
         
            -
                  when CIM::Variant then @ 
     | 
| 
      
 35 
     | 
    
         
            +
                  when NilClass then     @value.nil?
         
     | 
| 
      
 36 
     | 
    
         
            +
                  when FalseClass then   !@value
         
     | 
| 
      
 37 
     | 
    
         
            +
                  when TrueClass then    @value
         
     | 
| 
      
 38 
     | 
    
         
            +
                  when String then       @value == v
         
     | 
| 
      
 39 
     | 
    
         
            +
                  when Integer then      @value == v
         
     | 
| 
      
 40 
     | 
    
         
            +
                  when Float then        @value == v
         
     | 
| 
      
 41 
     | 
    
         
            +
                  when CIM::Variant then @value == v.value
         
     | 
| 
       41 
42 
     | 
    
         
             
                  else
         
     | 
| 
       42 
43 
     | 
    
         
             
            	false
         
     | 
| 
       43 
44 
     | 
    
         
             
                  end			
         
     | 
| 
       44 
45 
     | 
    
         
             
                end
         
     | 
| 
       45 
46 
     | 
    
         
             
                #
         
     | 
| 
      
 47 
     | 
    
         
            +
                # Check type against Ruby class
         
     | 
| 
      
 48 
     | 
    
         
            +
                #
         
     | 
| 
      
 49 
     | 
    
         
            +
                def is_a? klass
         
     | 
| 
      
 50 
     | 
    
         
            +
            #      puts "Variant#is_a? : #{self.inspect} is_a #{klass.class}:#{klass.inspect}"
         
     | 
| 
      
 51 
     | 
    
         
            +
                  case klass
         
     | 
| 
      
 52 
     | 
    
         
            +
                  when NilClass      then @type.matches? :null
         
     | 
| 
      
 53 
     | 
    
         
            +
                  when FalseClass    then @type.matches? :boolean
         
     | 
| 
      
 54 
     | 
    
         
            +
                  when TrueClass     then @type.matches? :boolean
         
     | 
| 
      
 55 
     | 
    
         
            +
                  when Integer       then @type.matches?(:uint64) || @type.matches?(:sint64) 
         
     | 
| 
      
 56 
     | 
    
         
            +
                  when Float         then @type.matches? :real32
         
     | 
| 
      
 57 
     | 
    
         
            +
                  when Symbol        then @type.matches? klass
         
     | 
| 
      
 58 
     | 
    
         
            +
                  when String        then
         
     | 
| 
      
 59 
     | 
    
         
            +
                    @type.matches? :string
         
     | 
| 
      
 60 
     | 
    
         
            +
                  when CIM::Variant  then @type.matches? klass.type
         
     | 
| 
      
 61 
     | 
    
         
            +
                  else
         
     | 
| 
      
 62 
     | 
    
         
            +
                    if klass == Integer
         
     | 
| 
      
 63 
     | 
    
         
            +
                      @type.matches?(:uint64) || @type.matches?(:sint64) 
         
     | 
| 
      
 64 
     | 
    
         
            +
                    elsif klass == Float
         
     | 
| 
      
 65 
     | 
    
         
            +
                      @type.matches? :real32
         
     | 
| 
      
 66 
     | 
    
         
            +
                    elsif klass == String
         
     | 
| 
      
 67 
     | 
    
         
            +
                      @type.matches? :string
         
     | 
| 
      
 68 
     | 
    
         
            +
                    else
         
     | 
| 
      
 69 
     | 
    
         
            +
            #          puts "Nothing matches #{klass}:#{klass.inspect}"
         
     | 
| 
      
 70 
     | 
    
         
            +
                      false
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
                  end
         
     | 
| 
      
 73 
     | 
    
         
            +
                end
         
     | 
| 
      
 74 
     | 
    
         
            +
                #
         
     | 
| 
       46 
75 
     | 
    
         
             
                # returns a string representation in MOF syntax format
         
     | 
| 
       47 
76 
     | 
    
         
             
                #
         
     | 
| 
       48 
77 
     | 
    
         
             
                def to_s
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,55 +1,48 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cim
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.4. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.4.2
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Klaus Kämpf
         
     | 
| 
       9 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-01-15 00:00:00.000000000 Z
         
     | 
| 
       13 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
14 
     | 
    
         
             
              name: rake
         
     | 
| 
       16 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       17 
     | 
    
         
            -
                none: false
         
     | 
| 
       18 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
     | 
    
         
            -
                - -  
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       20 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       21 
19 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       22 
20 
     | 
    
         
             
              type: :development
         
     | 
| 
       23 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       25 
     | 
    
         
            -
                none: false
         
     | 
| 
       26 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - -  
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       28 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
26 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       30 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       31 
28 
     | 
    
         
             
              name: bundler
         
     | 
| 
       32 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       33 
     | 
    
         
            -
                none: false
         
     | 
| 
       34 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       35 
     | 
    
         
            -
                - -  
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       36 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       37 
33 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       38 
34 
     | 
    
         
             
              type: :development
         
     | 
| 
       39 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       40 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       41 
     | 
    
         
            -
                none: false
         
     | 
| 
       42 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       43 
     | 
    
         
            -
                - -  
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       44 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       45 
40 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       46 
     | 
    
         
            -
            description:  
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
            description: |-
         
     | 
| 
      
 42 
     | 
    
         
            +
              Instances of Cim classes are used to define a CIM
         
     | 
| 
       48 
43 
     | 
    
         
             
              schema, often represented as a .mof file. See
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
44 
     | 
    
         
             
              http://www.dmtf.org/standards/cim and
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
              http://www.dmtf.org/education/mof for details'
         
     | 
| 
      
 45 
     | 
    
         
            +
              http://www.dmtf.org/education/mof for details
         
     | 
| 
       53 
46 
     | 
    
         
             
            email:
         
     | 
| 
       54 
47 
     | 
    
         
             
            - kkaempf@suse.de
         
     | 
| 
       55 
48 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -58,46 +51,44 @@ extra_rdoc_files: 
     | 
|
| 
       58 
51 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       59 
52 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       60 
53 
     | 
    
         
             
            files:
         
     | 
| 
      
 54 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 55 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
       61 
56 
     | 
    
         
             
            - lib/cim.rb
         
     | 
| 
       62 
     | 
    
         
            -
            - lib/cim/ 
     | 
| 
       63 
     | 
    
         
            -
            - lib/cim/ 
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/cim/class.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/cim/class_feature.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/cim/instance.rb
         
     | 
| 
       64 
60 
     | 
    
         
             
            - lib/cim/method.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/cim/named_element.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/cim/property.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/cim/qualifier.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/cim/qualifier_declaration.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            - lib/cim/qualifier_flavors.rb
         
     | 
| 
       65 
66 
     | 
    
         
             
            - lib/cim/qualifier_scopes.rb
         
     | 
| 
       66 
     | 
    
         
            -
            - lib/cim/instance.rb
         
     | 
| 
       67 
67 
     | 
    
         
             
            - lib/cim/qualifier_set.rb
         
     | 
| 
       68 
68 
     | 
    
         
             
            - lib/cim/reference.rb
         
     | 
| 
       69 
     | 
    
         
            -
            - lib/cim/ 
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/cim/type.rb
         
     | 
| 
       70 
70 
     | 
    
         
             
            - lib/cim/variant.rb
         
     | 
| 
       71 
     | 
    
         
            -
            - lib/cim/class_feature.rb
         
     | 
| 
       72 
     | 
    
         
            -
            - lib/cim/class.rb
         
     | 
| 
       73 
     | 
    
         
            -
            - lib/cim/named_element.rb
         
     | 
| 
       74 
     | 
    
         
            -
            - lib/cim/qualifier_declaration.rb
         
     | 
| 
       75 
     | 
    
         
            -
            - lib/cim/qualifier.rb
         
     | 
| 
       76 
     | 
    
         
            -
            - README.rdoc
         
     | 
| 
       77 
     | 
    
         
            -
            - LICENSE
         
     | 
| 
       78 
71 
     | 
    
         
             
            homepage: https://github.com/kkaempf/cim
         
     | 
| 
       79 
72 
     | 
    
         
             
            licenses: []
         
     | 
| 
      
 73 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       80 
74 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       81 
75 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       82 
76 
     | 
    
         
             
            require_paths:
         
     | 
| 
       83 
77 
     | 
    
         
             
            - lib
         
     | 
| 
       84 
78 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       85 
     | 
    
         
            -
              none: false
         
     | 
| 
       86 
79 
     | 
    
         
             
              requirements:
         
     | 
| 
       87 
     | 
    
         
            -
              - -  
     | 
| 
      
 80 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       88 
81 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       89 
82 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       90 
83 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       91 
     | 
    
         
            -
              none: false
         
     | 
| 
       92 
84 
     | 
    
         
             
              requirements:
         
     | 
| 
       93 
     | 
    
         
            -
              - -  
     | 
| 
      
 85 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       94 
86 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       95 
87 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       96 
88 
     | 
    
         
             
            requirements: []
         
     | 
| 
       97 
89 
     | 
    
         
             
            rubyforge_project: cim
         
     | 
| 
       98 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 90 
     | 
    
         
            +
            rubygems_version: 2.4.5
         
     | 
| 
       99 
91 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       100 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 92 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       101 
93 
     | 
    
         
             
            summary: A pure-Ruby implementation of the CIM meta model
         
     | 
| 
       102 
94 
     | 
    
         
             
            test_files: []
         
     | 
| 
       103 
     | 
    
         
            -
            has_rdoc: 
         
     |