Module: R2CORBA::CORBA::Portable::Stub

Included in:
Stub
Defined in:
lib/corba/common/Stub.rb

Constant Summary collapse

Id =
'IDL:omg.org/CORBA/Object:1.0'.freeze
Ids =
[Id].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/corba/common/Stub.rb', line 16

def self.included(klass)
  klass.class_eval do

    def init
      init_corba_portable_stub
    end

    def self.create_stub(obj)
      raise CORBA::INV_OBJREF.new unless obj.is_a?(CORBA::Object)

      obj.extend(self) unless obj.is_a?(self)
      obj.init
      return obj
    end

  end
end

Instance Method Details

#_is_a?(str) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/corba/common/Stub.rb', line 67

def _is_a?(str)
  _ids.include?(str) || super(str)
end

#_narrow!(klass) ⇒ Object

Raises:

  • (CORBA::OBJECT_NOT_EXIST)


49
50
51
52
53
54
55
56
# File 'lib/corba/common/Stub.rb', line 49

def _narrow!(klass)
  raise CORBA::OBJECT_NOT_EXIST.new('Nil object narrowed!') if self._is_nil?
  raise(TypeError, "invalid object narrowed: #{self.class}") unless self.is_a?(CORBA::Stub) && self._is_a?(klass::Id)

  self.extend klass
  _append_ids(*klass::Ids)
  return self
end

#_unchecked_narrow!(klass) ⇒ Object

Raises:

  • (CORBA::OBJECT_NOT_EXIST)


58
59
60
61
62
63
64
65
# File 'lib/corba/common/Stub.rb', line 58

def _unchecked_narrow!(klass)
  raise CORBA::OBJECT_NOT_EXIST.new('Nil object narrowed!') if self._is_nil?
  raise(TypeError, "invalid object narrowed: #{self.class}") unless self.is_a?(CORBA::Stub)

  self.extend klass
  _append_ids(*klass::Ids)
  return self
end

#inspectObject



71
72
73
74
75
76
# File 'lib/corba/common/Stub.rb', line 71

def inspect
  s = ''
  s << self.class.name.to_s << "\n" <<
       "type_id: \n" <<
       '  ' << @ids.join("\n  ") << "\n"
end