Returns the short user name of the currently logged in user. Unfortunately, it is often rather easy to fool ::getlogin
.
Avoid ::getlogin
for security-related purposes.
If ::getlogin
fails, try ::getpwuid
.
See the unix manpage for getpwuid(3)
for more detail.
e.g.
Etc.getlogin -> 'guest'
Returns the current list of converters in effect for headers. See CSV::new
for details. Built-in converters will be returned by name, while others will be returned as is.
Returns garbage collector generation for the given object
.
class B include ObjectSpace def foo trace_object_allocations do obj = Object.new p "Generation is #{allocation_generation(obj)}" end end end B.new.foo #=> "Generation is 3"
See ::trace_object_allocations
for more information and examples.
debugging output for msg
The server hostname
The server hostname
Returns true
if num
is an Integer
(including Fixnum
and Bignum
).
(1.0).integer? #=> false (1).integer? #=> true
Since int
is already an Integer
, this always returns true
.
Returns a new Time
object representing time in local time (using the local time zone in effect for this process).
If utc_offset
is given, it is used instead of the local time. utc_offset
can be given as a human-readable string (eg. "+09:00"
) or as a number of seconds (eg. 32400
).
t = Time.utc(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC t.utc? #=> true l = t.getlocal #=> 2000-01-01 14:15:01 -0600 l.utc? #=> false t == l #=> true j = t.getlocal("+09:00") #=> 2000-01-02 05:15:01 +0900 j.utc? #=> false t == j #=> true k = t.getlocal(9*60*60) #=> 2000-01-02 05:15:01 +0900 k.utc? #=> false t == k #=> true
Obtains the port number for service_name.
If protocol_name is not given, “tcp” is assumed.
Socket.getservbyname("smtp") #=> 25 Socket.getservbyname("shell") #=> 514 Socket.getservbyname("syslog", "udp") #=> 514
Obtains the port number for port.
If protocol_name is not given, “tcp” is assumed.
Socket.getservbyport(80) #=> "www" Socket.getservbyport(514, "tcp") #=> "shell" Socket.getservbyport(514, "udp") #=> "syslog"