org.jruby.util
Interface TypeCoercer


public interface TypeCoercer

Author:
headius

Method Summary
 IRubyObject anyToString(IRubyObject src)
           
 RubyString asString(IRubyObject src)
          rb_obj_as_string
 IRubyObject checkArrayType(IRubyObject src)
           
 IRubyObject checkStringType(IRubyObject src)
           
 RubyArray convertToArray(IRubyObject src)
          Methods which perform to_xxx if the object has such a method
 RubyFloat convertToFloat(IRubyObject src)
           
 RubyHash convertToHash(IRubyObject src)
           
 RubyInteger convertToInteger(IRubyObject src)
           
 RubyInteger convertToInteger(IRubyObject src, int convertMethodIndex, java.lang.String convertMethod)
           
 RubyString convertToString(IRubyObject src)
           
 IRubyObject convertToType(IRubyObject src, RubyClass targetType, int convertMethodIndex, java.lang.String convertMethod)
          Converts this object to type 'targetType' using 'convertMethod' method and raises TypeError exception on failure (MRI: rb_convert_type).
 IRubyObject convertToType(IRubyObject src, RubyClass targetType, int convertMethodIndex, java.lang.String convertMethod, boolean raiseOnError)
          Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type).
 IRubyObject convertToTypeWithCheck(IRubyObject src, RubyClass targetType, int convertMethodIndex, java.lang.String convertMethod)
          Higher level conversion utility similar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).
 

Method Detail

convertToArray

RubyArray convertToArray(IRubyObject src)
Methods which perform to_xxx if the object has such a method

Returns:

convertToHash

RubyHash convertToHash(IRubyObject src)
Returns:

convertToFloat

RubyFloat convertToFloat(IRubyObject src)
Returns:

convertToInteger

RubyInteger convertToInteger(IRubyObject src)
Returns:

convertToInteger

RubyInteger convertToInteger(IRubyObject src,
                             int convertMethodIndex,
                             java.lang.String convertMethod)
Returns:

convertToString

RubyString convertToString(IRubyObject src)
Returns:

convertToType

IRubyObject convertToType(IRubyObject src,
                          RubyClass targetType,
                          int convertMethodIndex,
                          java.lang.String convertMethod,
                          boolean raiseOnError)
Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type).

Parameters:
targetType - is the type we are trying to convert to
convertMethod - is the method to be called to try and convert to targeType
raiseOnError - will throw an Error if conversion does not work
Returns:
the converted value

convertToType

IRubyObject convertToType(IRubyObject src,
                          RubyClass targetType,
                          int convertMethodIndex,
                          java.lang.String convertMethod)
Converts this object to type 'targetType' using 'convertMethod' method and raises TypeError exception on failure (MRI: rb_convert_type).

Parameters:
targetType - is the type we are trying to convert to
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value

convertToTypeWithCheck

IRubyObject convertToTypeWithCheck(IRubyObject src,
                                   RubyClass targetType,
                                   int convertMethodIndex,
                                   java.lang.String convertMethod)
Higher level conversion utility similar to convertToType but it can throw an additional TypeError during conversion (MRI: rb_check_convert_type).

Parameters:
targetType - is the type we are trying to convert to
convertMethod - is the method to be called to try and convert to targeType
Returns:
the converted value

anyToString

IRubyObject anyToString(IRubyObject src)
Returns:

asString

RubyString asString(IRubyObject src)
rb_obj_as_string

Returns:

checkStringType

IRubyObject checkStringType(IRubyObject src)
Returns:

checkArrayType

IRubyObject checkArrayType(IRubyObject src)
Returns:


Copyright © 2002-2007 JRuby Team. All Rights Reserved.