Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 677

Show
Ignore:
Timestamp:
01/12/03 11:13:37 (6 years ago)
Author:
nahi
Message:

Avoid implicit use String as a regexp source.
Float("1.4e") may fail on some libc environment. Try again with "1.4e0" if it

fails.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/XMLSchemaDatatypes.rb

    r660 r677  
    255255 
    256256    integerPart = '0' if integerPart.empty? 
    257     fractionPart = fractionPart ? fractionPart.sub( '0+$', '' ) : '' 
     257    fractionPart = fractionPart ? fractionPart.sub( /0+$/, '' ) : '' 
    258258    @point = - fractionPart.size 
    259259    @number = integerPart + fractionPart 
     
    374374        @data = Float( str ) 
    375375      rescue ArgumentError 
    376         raise ValueSpaceError.new( "#{ type }: cannot accept '#{ str }'." ) 
     376        # '1.4e' cannot be parsed on some architecture. 
     377        if /e\z/i =~ str 
     378          begin 
     379            @data = Float( str + '0' ) 
     380          rescue ArgumentError 
     381            raise ValueSpaceError.new( "#{ type }: cannot accept '#{ str }'." ) 
     382          end 
     383        else 
     384          raise ValueSpaceError.new( "#{ type }: cannot accept '#{ str }'." ) 
     385        end 
    377386      end 
    378387    end 
     
    515524      @data = DateTime.civil( *( t.dup.gmtime.to_a[ 0..5 ].reverse )) 
    516525      diffDay = t.utc_offset.to_r / SecInDay 
    517       @data = @data.newof( diffDay ) 
     526      @data = @data.new_offset( diffDay ) 
    518527    else 
    519528      set_str( t ) 
     
    583592      shiftSize = fr.denominator.to_s.size 
    584593      fr_s = ( fr * ( 10 ** shiftSize )).to_i.to_s 
    585       s << '.' << '0' * ( shiftSize - fr_s.size ) << fr_s.sub( '0+$', '' ) 
     594      s << '.' << '0' * ( shiftSize - fr_s.size ) << fr_s.sub( /0+$/, '' ) 
    586595    end 
    587596    addTz( s ) 
     
    626635      shiftSize = fr.denominator.to_s.size 
    627636      fr_s = ( fr * ( 10 ** shiftSize )).to_i.to_s 
    628       s << '.' << '0' * ( shiftSize - fr_s.size ) << fr_s.sub( '0+$', '' ) 
     637      s << '.' << '0' * ( shiftSize - fr_s.size ) << fr_s.sub( /0+$/, '' ) 
    629638    end 
    630639    addTz( s )