class Hessian2::TypeWrapper

Attributes

hessian_type[R]
is_multi[R]
object[RW]

Public Class Methods

new(type, object) click to toggle source
# 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

Public Instance Methods

is_multi?() click to toggle source
# File lib/hessian2/type_wrapper.rb, line 27
def is_multi?
  @is_multi
end

Private Instance Methods

unify_type(type) click to toggle source
# File lib/hessian2/type_wrapper.rb, line 34
def unify_type(type)
  case type
  when 'L', 'l', 'Long', 'long', :long
    'L'
  when 'I', 'i', 'Integer', 'int', :int
    'I'
  when 'B', 'b', 'Binary', 'bin', :bin
    'B'
  else
    type
  end
end