Class: Integer — Documentation by YARD 0.9.44

# Class: Integer

Inherits:
  Object
  - Object
  - Integer
  show all

Defined in:
  lib/unisec/utils.rb

## Instance Method Summary collapse

- #to_bin ⇒ String

  Convert an integer to an binary string.

- #to_hex ⇒ String

  Convert an integer to an hexadecimal string.

## Instance Method Details

### #to_bin ⇒ `String`

Convert an integer to an binary string

#### Examples:

    42.to_bin # => "101010"

Returns:

- (`String`) —

  The interger converted to binary and casted to a string

    18
    19
    20
    # File 'lib/unisec/utils.rb', line 18

    def to_bin
      to_s(2)
    end

### #to_hex ⇒ `String`

Convert an integer to an hexadecimal string

#### Examples:

    42.to_hex # => "2A"

Returns:

- (`String`) —

  The interger converted to hexadecimal and casted to an upper case string

    10
    11
    12
    # File 'lib/unisec/utils.rb', line 10

    def to_hex
      to_s(16).upcase
    end