Class: CIM::Method

Inherits:
ClassFeature show all
Defined in:
lib/cim/method.rb

Overview

A Method defines a function member of a Class.

For data members, see Property.

Instance Attribute Summary

Attributes inherited from ClassFeature

#type

Attributes inherited from NamedElement

#name, #qualifiers

Instance Method Summary collapse

Methods inherited from ClassFeature

#key?, #property?, #reference?, #static?

Methods inherited from NamedElement

#<<, #include?

Constructor Details

#initialize(type, name, qualifiers = nil, parameters = nil) ⇒ Method

Create a Method with return type (Type) and name (String), optional Qualifiers and parameters (Property)

call-seq:

Method.new(:boolean, "do_something")
Method.new(:boolean, "do_something", qualifiers)
Method.new(:boolean, "do_something", qualifiers, parameters)


25
26
27
28
# File 'lib/cim/method.rb', line 25

def initialize type, name, qualifiers = nil, parameters = nil
  @parameters = parameters
  super type,name,qualifiers
end

Instance Method Details

#method?Boolean

Makes a Method recognizable in the set of Class features.

Returns:

  • (Boolean)


38
39
40
# File 'lib/cim/method.rb', line 38

def method?
  true
end

#parametersObject

parameters accessor



32
33
34
# File 'lib/cim/method.rb', line 32

def parameters
  @parameters || []
end

#to_sObject

returns a string representation in MOF syntax format



44
45
46
47
# File 'lib/cim/method.rb', line 44

def to_s
  p = parameters.join(", ")
  "#{super}(#{p})"
end