Class: MiqAeMethodService::MiqAeServiceObject

Inherits:
Object
  • Object
show all
Includes:
DRbUndumped, MiqAeServiceObjectCommon
Defined in:
lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object.rb

Instance Method Summary collapse

Methods included from MiqAeServiceObjectCommon

#[], #[]=, #attributes, #attributes=, #class_name, #current_field_name, #current_field_type, #current_message, #decrypt, #id, #instance_name, #name, #namespace, #parent

Constructor Details

#initialize(obj, svc) ⇒ MiqAeServiceObject


7
8
9
10
11
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object.rb', line 7

def initialize(obj, svc)
  raise "object cannot be nil" if obj.nil?
  @object  = obj
  @service = svc
end

Instance Method Details

#children(name = nil) ⇒ Object


13
14
15
16
17
18
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object.rb', line 13

def children(name = nil)
  objs = @object.children(name)
  return nil if objs.nil?
  objs = @service.objects([objs].flatten)
  objs.length == 1 ? objs.first : objs
end

#inspectObject


24
25
26
27
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object.rb', line 24

def inspect
  hex_id = (object_id << 1).to_s(16).rjust(14, '0')
  "#<#{self.class.name}:0x#{hex_id} name: #{name.inspect}>"
end

#to_sObject


20
21
22
# File 'lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_object.rb', line 20

def to_s
  name
end