The Base64 module provides for the encoding (#encode64, strict_encode64, urlsafe_encode64) and decoding (#decode64, strict_decode64, urlsafe_decode64) of binary data using a Base64 representation. Example¶ ↑ A simple encoding and decoding. require "base64" enc = Base64.encode64('Send reinforcements') # -> "U2VuZCByZWluZm9yY2VtZW50cw==\n" plain = Base64.decode64(enc) # -> "Send reinforcements" The
The ObjectSpace module contains a number of routines that interact with the garbage collection facility and allow you to traverse all living objects with an iterator. ObjectSpace also provides support for object finalizers, procs that will be called when a specific object is about to be destroyed by garbage collection. a = "A" b = "B" ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one
Time is an abstraction of dates and times. Time is stored internally as the number of seconds with fraction since the Epoch, January 1, 1970 00:00 UTC. Also see the library module Date. The Time class treats GMT (Greenwich Mean Time) and UTC (Coordinated Universal Time) as equivalent. GMT is the older way of referring to these baseline times but persists in the names of calls on POSIX systems. All
Creates a new Lazy enumerator. When the enumerator is actually enumerated (e.g. by calling force), obj will be enumerated and each value passed to the given block. The block can yield values back using yielder. For example, to create a method filter_map in both lazy and non-lazy fashions: module Enumerable def filter_map(&block) map(&block).compact end end class Enumerator::Lazy def filter_map Laz
A class that provides the functionality of Kernel#set_trace_func in a nice Object-Oriented API. Example¶ ↑ We can use TracePoint to gather information specifically for exceptions: trace = TracePoint.new(:raise) do |tp| p [tp.lineno, tp.event, tp.raised_exception] end #=> #<TracePoint:0x007f786a452448> trace.enable #=> #<TracePoint:0x007f786a452448> 0 / 0 #=> [5, :raise, #<ZeroDivisionError: divide
The Enumerable mixin provides collection classes with several traversal and searching methods, and with the ability to sort. The class must provide a method each, which yields successive members of the collection. If Enumerable#max, #min, or #sort is used, the objects in the collection must also implement a meaningful <=> operator, as these methods rely on an ordering between members of the collec
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く