るりまサーチ

最速Rubyリファレンスマニュアル検索!
74件ヒット [1-74件を表示] (0.037秒)

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. float >
  4. module >
  5. complex >

ライブラリ

クラス

モジュール

キーワード

検索結果

Random.bytes(size) -> String (18214.0)

ランダムなバイナリー文字列を返します。結果の文字列のサイズを指定できます。

...ランダムなバイナリー文字列を返します。結果の文字列のサイズを指定できます。

@param size 結果の文字列のサイズをバイト数で指定します。

//emlist[][ruby]{
Random.bytes(10) # => "\xAC\n\x7F\x8C/\xAA\xC4\x97u\xA6"
//}

@see Random#bytes...

SecureRandom.random_bytes(n = nil) -> String (6208.0)

ランダムなバイト列を生成して返します。

...字列のサイズを整数で指定します。
nil を指定した場合 n として 16 が使われます。

@raise NotImplementedError 安全な乱数発生器が使えない場合に発生します。

require 'securerandom'
p SecureRandom.random_bytes(3) #=> "\321\020\203"...

GC.stat(result_hash = {}) -> {Symbol => Integer} (225.0)

GC 内部の統計情報を Hash で返します。

...# =>
{
:count=>0,
:heap_allocated_pages=>24,
:heap_sorted_length=>24,
:heap_allocatable_pages=>0,
:heap_available_slots=>9783,
:heap_live_slots=>7713,
:heap_free_slots=>2070,
:heap_final_slots=>0,
:heap_marked_slots=>0,
:heap_swept_slots=>0,...
...ages=>24,
:heap_tomb_pages=>0,
:total_allocated_pages=>24,
:total_freed_pages=>0,
:total_allocated_objects=>7796,
:total_freed_objects=>83,
:malloc_increase_bytes=>2389312,
:malloc_increase_bytes_limit=>16777216,
:minor_gc_count=>0,
:major_gc_count=>0,...
...:remembered_wb_unprotected_objects=>0,
:remembered_wb_unprotected_objects_limit=>0,
:old_objects=>0,
:old_objects_limit=>0,
:oldmalloc_increase_bytes=>2389760,
:oldmalloc_increase_bytes_limit=>16777216
}

戻り値のハッシュは処理系に依存します。これ...

String.new(string = "", encoding: string.encoding, capacity: string.bytesize) -> String (201.0)

string と同じ内容の新しい文字列を作成して返します。 引数を省略した場合は空文字列を生成して返します。

...string.bytesizeになります。
@return 引数 string と同じ内容の文字列オブジェクト

//emlist[例][ruby]{
text = "hoge".encode("EUC-JP")
no_option = String.new(text) # => "hoge"
no_option.encoding == Encoding::EUC_JP # => true
w...
...ith_encoding = String.new(text, encoding: "UTF-8") # => "hoge"
with_encoding.encoding == Encoding::UTF_8 # => true
String.new("test", encoding: "UTF-8", capacity: 100_000) # => "test"
//}...

GC.stat(key) -> Numeric (125.0)

GC 内部の統計情報を Hash で返します。

...# =>
{
:count=>0,
:heap_allocated_pages=>24,
:heap_sorted_length=>24,
:heap_allocatable_pages=>0,
:heap_available_slots=>9783,
:heap_live_slots=>7713,
:heap_free_slots=>2070,
:heap_final_slots=>0,
:heap_marked_slots=>0,
:heap_swept_slots=>0,...
...ages=>24,
:heap_tomb_pages=>0,
:total_allocated_pages=>24,
:total_freed_pages=>0,
:total_allocated_objects=>7796,
:total_freed_objects=>83,
:malloc_increase_bytes=>2389312,
:malloc_increase_bytes_limit=>16777216,
:minor_gc_count=>0,
:major_gc_count=>0,...
...:remembered_wb_unprotected_objects=>0,
:remembered_wb_unprotected_objects_limit=>0,
:old_objects=>0,
:old_objects_limit=>0,
:oldmalloc_increase_bytes=>2389760,
:oldmalloc_increase_bytes_limit=>16777216
}

戻り値のハッシュは処理系に依存します。これ...

絞り込み条件を変える

Socket.getifaddrs -> [Socket::Ifaddr] (125.0)

インターフェイスのアドレスを Socket::Ifaddr の配列で返します。

...}
#=> [["eth0", 2, #<Addrinfo: 221.186.184.67>],
# ["eth0", 2, #<Addrinfo: fe80::216:3eff:fe95:88bb%eth0>]]

例(GNU/Linux):

require 'socket'

pp Socket.getifaddrs
#=> [#<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 PACKET[protocol=0 lo hatype=772 HOST hwaddr=00:00:00:00:00:00]>,
#...
...KET[protocol=0 eth0 hatype=1 HOST hwaddr=ff:ff:ff:ff:ff:ff]>,
# #<Socket::Ifaddr sit0 NOARP PACKET[protocol=0 sit0 hatype=776 HOST hwaddr=00:00:00:00]>,
# #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 127.0.0.1 netmask=255.0.0.0>,
# #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICA...
...5.240 broadcast=221.186.184.79>,
# #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 ::1 netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>,
# #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 fe80::216:3eff:fe95:88bb%eth0 netmask=ffff:ffff:ffff:ffff::>]

例(FreeBSD):

require 's...

WIN32OLE_VARIANT.new(val, vartype = nil) -> WIN32OLE_VARIANT (125.0)

指定したオブジェクトを値とするWIN32OLE_VARIANTオブジェクトを生成します。

...l.NameSpace('C:\\Users\\Public\\Documents')
item = folder.ParseName('test.txt')
v = WIN32OLE_VARIANT.new('Delete')
item.invokeVerb(v) # => ゴミ箱への移動ダイアログを表示

バイト配列を生成するには、以下のようにvartype引数にVT_UI1 | VT_ARRAYを
設定...
...ンコーディングをASCII-8BITに設
定した文字列となります。

include WIN32OLE::VARIANT
bytes
= WIN32OLE_VARIANT.new([1,2,3,4,5], VT_UI1 | VT_ARRAY)
bytes
.value #=> "\x01\x02\x03\x04\x05"
bytes
.value.encoding #=> #<Encoding:ASCII-8BIT>

@see WIN32OLE::VARIANT...