Class: R2CORBA::CORBA::TypeCode::Fixed

Inherits:
R2CORBA::CORBA::TypeCode show all
Defined in:
lib/corba/cbase/Typecode.rb,
lib/corba/jbase/Typecode.rb,
lib/corba/common/Typecode.rb

Overview

WString

Constant Summary

Constants inherited from R2CORBA::CORBA::TypeCode

LongLongRange, LongRange, OctetRange, ShortRange, ULongLongRange, ULongRange, UShortRange

Instance Attribute Summary

Attributes inherited from R2CORBA::CORBA::TypeCode

#tc_

Instance Method Summary collapse

Methods inherited from R2CORBA::CORBA::TypeCode

_tc, _wrap_native, #concrete_base_type, #content_type, #default_index, #discriminator_type, #equal?, #equivalent?, #fixed_digits, #fixed_scale, from_native, #get_compact_typecode, get_primitive_tc, #id, #is_recursive_tc?, #kind, #length, #member_count, #member_label, #member_name, #member_type, #member_visibility, #name, native_kind, register_id_type, #resolved_tc, #type_modifier, typecode_for_id, typecodes_for_name

Constructor Details

#initialize(*args) ⇒ Fixed

Returns a new instance of Fixed.



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/corba/cbase/Typecode.rb', line 71

def initialize(*args)
  if CORBA::Native::TypeCode === args.first
    @tc_ = args.first
  else
    digits, scale = args
    begin
      @tc_ = CORBA::Native::TypeCode.create_tc(TK_FIXED, digits.to_i, scale.to_i)
    rescue ::NativeException
      CORBA::Exception.native2r($!)
    end
  end
end

Instance Method Details

#get_typeObject



504
505
506
# File 'lib/corba/common/Typecode.rb', line 504

def get_type
  ::BigDecimal
end

#needs_conversion(val) ⇒ Object



516
517
518
# File 'lib/corba/common/Typecode.rb', line 516

def needs_conversion(val)
  !(::BigDecimal === val)
end

#validate(val) ⇒ Object



508
509
510
511
512
513
514
# File 'lib/corba/common/Typecode.rb', line 508

def validate(val)
  return val if val.nil?

  super(val) unless ::BigDecimal === val || val.respond_to?(:to_str)
  val = ::BigDecimal === val ? val : BigDecimal(val.to_str)
  val
end