Class: CIM::Property
- Inherits:
-
ClassFeature
- Object
- NamedElement
- ClassFeature
- CIM::Property
- Defined in:
- lib/cim/property.rb
Overview
A Property defines a data member of a Class.
For method members, see Method.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
Attributes inherited from ClassFeature
Attributes inherited from NamedElement
Instance Method Summary collapse
-
#initialize(type, name, qualifier_set = nil, default = nil) ⇒ Property
constructor
Create a Property with type (Type) and name (String), optional QualifierSet and default value.
-
#method_missing(name, *args) ⇒ Object
Check for qualifiers.
-
#property? ⇒ Boolean
Makes a Property recognizable in the set of Class features.
Methods inherited from ClassFeature
Methods inherited from NamedElement
Constructor Details
#initialize(type, name, qualifier_set = nil, default = nil) ⇒ Property
26 27 28 29 |
# File 'lib/cim/property.rb', line 26 def initialize type, name, qualifier_set=nil, default=nil @default = default super type, name, qualifier_set end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
Check for qualifiers
# check for existance
element.qualifier? -> true or false
# check value
element.description -> String or nil
45 46 47 48 49 50 51 |
# File 'lib/cim/property.rb', line 45 def method_missing name, *args if name.to_s[-1,1] == "?" @qualifiers && @qualifiers.include?(name.to_s[0...-1]) else (@qualifiers[name].value || @qualifiers[name].declaration.default) rescue nil end end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
17 18 19 |
# File 'lib/cim/property.rb', line 17 def default @default end |
Instance Method Details
#property? ⇒ Boolean
Makes a Property recognizable in the set of Class features.
33 34 35 |
# File 'lib/cim/property.rb', line 33 def property? true end |