Class: Hprose::ClassManager

Inherits:
Object
  • Object
show all
Defined in:
lib/hprose/io.rb

Overview

module Stream

Class Method Summary collapse

Class Method Details

.getClass(aliasname) ⇒ Object



155
156
157
158
159
160
# File 'lib/hprose/io.rb', line 155

def getClass(aliasname)
  return @@class_cache2[aliasname] if @@class_cache2.key?(aliasname)
  cls = get_class_by_alias(aliasname)
  register(cls, aliasname)
  return cls
end

.getClassAlias(cls) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/hprose/io.rb', line 162

def getClassAlias(cls)
  return @@class_cache1[cls] if @@class_cache1.key?(cls)
  if cls == Struct then
    aliasname = cls.to_s
    aliasname['Struct::'] = '' unless aliasname['Struct::'].nil?
  else
    aliasname = cls.to_s.split('::').join('_')
  end
  register(cls, aliasname)
  return aliasname
end

.register(cls, aliasname) ⇒ Object



148
149
150
151
152
153
# File 'lib/hprose/io.rb', line 148

def register(cls, aliasname)
  @@class_cache_lock.synchronize do
      @@class_cache1[cls] = aliasname
      @@class_cache2[aliasname] = cls
  end
end