Module: Rucc::Libc
- Defined in:
- lib/rucc/libc.rb
Overview
Emulate libc
Class Method Summary collapse
-
.isalnum(c) ⇒ Object
same with isalnum in libc.
-
.isalpha(c) ⇒ Object
same with isalpha in libc.
-
.isdigit(c) ⇒ Object
same with isdigit in libc.
-
.isprint(c) ⇒ Object
TODO(south37) Impl same logic with isprint in libc.
-
.ispunct(c) ⇒ Object
TODO(south37) Impl same logic with ispunct in libc.
-
.isspace(c) ⇒ Object
same with isspace in libc.
-
.isxdigit(c) ⇒ Object
same with isdigit in libc.
Class Method Details
.isalnum(c) ⇒ Object
same with isalnum in libc
31 32 33 |
# File 'lib/rucc/libc.rb', line 31 def isalnum(c) "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze.include?(c) end |
.isalpha(c) ⇒ Object
same with isalpha in libc
25 26 27 |
# File 'lib/rucc/libc.rb', line 25 def isalpha(c) "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze.include?(c) end |
.isdigit(c) ⇒ Object
same with isdigit in libc
13 14 15 |
# File 'lib/rucc/libc.rb', line 13 def isdigit(c) "0123456789".freeze.include?(c) end |
.isprint(c) ⇒ Object
TODO(south37) Impl same logic with isprint in libc
42 43 44 |
# File 'lib/rucc/libc.rb', line 42 def isprint(c) isalnum(c) || ispunct(c) || isspace(c) end |
.ispunct(c) ⇒ Object
TODO(south37) Impl same logic with ispunct in libc
37 38 39 |
# File 'lib/rucc/libc.rb', line 37 def ispunct(c) '!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~'.include?(c) end |
.isspace(c) ⇒ Object
same with isspace in libc
7 8 9 |
# File 'lib/rucc/libc.rb', line 7 def isspace(c) "\x20\x0c\x0a\x0d\x09\x0b".freeze.include?(c) end |
.isxdigit(c) ⇒ Object
same with isdigit in libc
19 20 21 |
# File 'lib/rucc/libc.rb', line 19 def isxdigit(c) "0123456789abcdefABCDEF".freeze.include?(c) end |