Sha256: c4536f171ecb93024842ac555afebc87190950b15a0102888ab56c4dec98dce0

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

<%
  # @classes[name] = { :path => mofpath, :mof => mofclass }

  def collect_superclasses name
    classdata = @classmap[name]
    raise "No such class: #{name}" unless classdata
    mofclass = classdata[:mof]
    superclass = mofclass.superclass
    [mofclass] + ((superclass)?collect_superclasses(superclass):[])
  end
%>

# Class information for <%= name %>
# Generated by 'wbem' for use with ruby-wbem

require 'rubygems'
require 'cim'
require 'wbem'

module Wbem

  class <%= name %> < Wbem::Instance
<% classes = collect_superclasses name %>
<% known_features = Hash.new %>
    TYPEMAP = {
<%    classes.each do |mofclass|
        mofclass.features.each do |f|
          next if known_features[f.name]
          known_features[f.name] = f
          if f.method? %>
        # <%= mofclass.name %>.<%= f.name %>()
        <%= f.name.inspect %> => [ <%= f.type.to_sym.inspect %>, <% f.parameters.each do |p| %>
            [ <%= p.name.inspect %>, <%= p.type.to_sym.inspect %>, <%= (p.includes?(:out))?":out":":in" %> ], <% end %>
          ],
        <% else %>
        # <%= mofclass.name %>.<%= f.name %>
        <%= f.name.inspect %> => <%= f.type.to_sym.inspect %>,
<%        end
        end
      end %>
    }
    
    def _typemap
      TYPEMAP
    end

  end # class
end # module

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wbem-0.5.1 lib/wbem/class_template.erb
wbem-0.5.0 lib/wbem/class_template.erb