module Raheui::IO

IO methods for user input and output.

Public Class Methods

print_chr(value) click to toggle source

Print an character from character code.

value - The Integer character code to print.

Examples

IO.print_chr(97)
# a=> nil

IO.print_chr(0xAC00)
# 가=> nil

# Rescue RangeError
IO.print_chr(-1)
# [U+..FF]=> nil

# Rescue RangeError
IO.print_chr(0x110000)
# [U+110000]=> nil

Returns nothing.

print_int(value) click to toggle source

Print an Integer.

value - The Integer to print.

Examples

IO.print_int(42)
# 42=> nil

Returns nothing.

read_chr() click to toggle source

Read an character from user input.

Returns the Integer character code of the character user entered.

# File lib/raheui/io.rb, line 16
def self.read_chr
  $stdin.getc.ord
end
read_int() click to toggle source

Read an Integer from user input.

Returns the Integer user entered.

# File lib/raheui/io.rb, line 9
def self.read_int
  $stdin.gets.to_i
end