Class: Hessian2::TypeWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/hessian2/type_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, object) ⇒ TypeWrapper

Returns a new instance of TypeWrapper.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hessian2/type_wrapper.rb', line 6

def initialize(type, object)
  if type.is_a?(Array)
    is_multi = true
    hessian_type = unify_type(type.first)
  elsif type.is_a?(String)
    if type.include?('[')
      is_multi = true
      hessian_type = unify_type(type.delete('[]'))
    else
      is_multi = false
      hessian_type = unify_type(type)
    end
  else
    is_multi = false
    hessian_type = unify_type(type)
  end

  @object, @hessian_type, @is_multi = object, hessian_type, is_multi
end

Instance Attribute Details

#hessian_typeObject (readonly)

Returns the value of attribute hessian_type.



4
5
6
# File 'lib/hessian2/type_wrapper.rb', line 4

def hessian_type
  @hessian_type
end

#is_multiObject (readonly)

Returns the value of attribute is_multi.



4
5
6
# File 'lib/hessian2/type_wrapper.rb', line 4

def is_multi
  @is_multi
end

#objectObject

Returns the value of attribute object.



3
4
5
# File 'lib/hessian2/type_wrapper.rb', line 3

def object
  @object
end

Instance Method Details

#is_multi?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/hessian2/type_wrapper.rb', line 27

def is_multi?
  @is_multi
end