Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/utc_rpn_calc/core_ext/fixnum.rb

Instance Method Summary collapse

Instance Method Details

#negateObject



6
7
8
9
10
# File 'lib/utc_rpn_calc/core_ext/fixnum.rb', line 6

def negate
    unsigned = ~self % (2**32)
    hex_string = unsigned.to_s(16)[-4,4]
    hex_string.hex
end

#to_formatted_hexObject



2
3
4
# File 'lib/utc_rpn_calc/core_ext/fixnum.rb', line 2

def to_formatted_hex
  to_s(16).rjust(4,'0').upcase
end