るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 3 > >>

Enumerable#zip(*lists) {|v1, v2, ...| ...} -> nil (8101.0)

self と引数に渡した配列の各要素からなる配列の配列を生成して返します。 生成される配列の要素数は self の要素数と同じです。

...を順番にブロックに渡します。

@param lists 配列を指定します。配列でない場合は to_ary メソッドにより配列に変換します。
to_ary メソッドが無い場合は each を試します。

//emlist[例][ruby]{
p (1..3).zip([4,5,6], [7,8,9])
# => [[...
...,:c], [:A,:B,:C,:D])
# => a, :A], [2, :b, :B

p (1..5).zip([:a,:b,:c], [:A,:B,:C,:D])
# => [[1, :a, :A], [2, :b, :B],
# [3, :c, :C], [4, nil, :D], [5, nil, nil]]
//}

//emlist[例][ruby]{
p [1,2,3].zip([4,5,6], [7,8,9]) {|ary|
p ary
}
# => [1, 4, 7]
# [2, 5, 8]
# [3, 6, 9]
# nil
//}...

Enumerator::Lazy#zip(*lists) -> Enumerator::Lazy (8101.0)

Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。

...返します。

ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>...

Enumerator::Lazy#zip(*lists) {|v1, v2, ...| ... } -> nil (8101.0)

Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。

...返します。

ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>...

Object#respond_to?(name, include_all = false) -> bool (8019.0)

オブジェクトがメソッド name を持つとき真を返します。

...) を指定した事になります。

//emlist[][ruby]{
class F
def hello
"Bonjour"
end
end

class D
private
def hello
"Guten Tag"
end
end
list
= [F.new,D.new]

list
.each{|it| puts it.hello if it.respond_to?(:hello)}
#=> Bonjour

list
.each{|it| it.instance_eval("puts hello if it....

ThreadGroup#add(thread) -> self (8019.0)

スレッド thread が属するグループを自身に変更します。

...ad が属する ThreadGroup が freeze されているか enclose されている場合にも発生します。

//emlist[例][ruby]{
puts "Initial group is #{ThreadGroup::Default.list}"
# => Initial group is [#<Thread:0x4a49168 run>]

tg = ThreadGroup.new
t1 = Thread.new { sleep }
t2 = Thread.new {...
...# => t1 is #<Thread:0x50bef60>
puts "t2 is #{t2}" # => t2 is #<Thread:0x50beed0>
tg.add(t1)
puts "Initial group now #{ThreadGroup::Default.list}"
# => Initial group now [#<Thread:0x3039168 run>, #<Thread:0x50beed0 run>]
puts "tg group now #{tg.list}"
# => tg group now [#<Thread:0x50bef60 run>]
//}...

絞り込み条件を変える

Array#pack(template) -> String (8013.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...ロトコルなどに適切)
//emlist{
n: big endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}

: エンディアン依存、整数サイズ依存 (C の構造体などに適切)
//emlist{
s!: signed short
S!: unsigned...
...stdint.h にある厳密な幅を持つ整数型に適切)
//emlist{
s: int16_t
S: uint16_t
l: int32_t
L: uint32_t
q: int64_t
Q: uint64_t
//}

: エンディアンの強制指定(バイナリ解析などに適切)
//emlist{
S>: big endian unsigned 16bit(nと同じ)
s>: big endian...
...emlist[][ruby]{
["abc"].pack("a") # => "a"
["abc"].pack("a*") # => "abc"
["abc"].pack("a4") # => "abc\x00"

"abc\0".unpack("a4") # => ["abc\x00"]
"abc ".unpack("a4") # => ["abc "]
//}

: A

ASCII文字列(スペースを詰める/後続するヌル文字やスペースを削除)
//emlist[]...
...では
ないことに注意してください。
buffer のサイズ(capacity)が足りなければ、packはメモリを確保します。

//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}

@param template 自身のバ...

Array#pack(template, buffer: String.new) -> String (8013.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...では
ないことに注意してください。
buffer のサイズ(capacity)が足りなければ、packはメモリを確保します。

//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}

@param template 自身のバ...
...ロトコルなどに適切)
//emlist{
n: big endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}

: エンディアン依存、整数サイズ依存 (C の構造体などに適切)
//emlist{
s!: signed short
S!: unsigned...
...stdint.h にある厳密な幅を持つ整数型に適切)
//emlist{
s: int16_t
S: uint16_t
l: int32_t
L: uint32_t
q: int64_t
Q: uint64_t
//}

: エンディアンの強制指定(バイナリ解析などに適切)
//emlist{
S>: big endian unsigned 16bit(nと同じ)
s>: big endian...

String#unpack(template) -> Array (8013.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...ロトコルなどに適切)
//emlist{
n: big endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}

: エンディアン依存、整数サイズ依存 (C の構造体などに適切)
//emlist{
s!: signed short
S!: unsigned...
...stdint.h にある厳密な幅を持つ整数型に適切)
//emlist{
s: int16_t
S: uint16_t
l: int32_t
L: uint32_t
q: int64_t
Q: uint64_t
//}

: エンディアンの強制指定(バイナリ解析などに適切)
//emlist{
S>: big endian unsigned 16bit(nと同じ)
s>: big endian...
...emlist[][ruby]{
["abc"].pack("a") # => "a"
["abc"].pack("a*") # => "abc"
["abc"].pack("a4") # => "abc\x00"

"abc\0".unpack("a4") # => ["abc\x00"]
"abc ".unpack("a4") # => ["abc "]
//}

: A

ASCII文字列(スペースを詰める/後続するヌル文字やスペースを削除)
//emlist[]...

String#crypt(salt) -> String (8007.0)

self と salt から暗号化された文字列を生成して返します。 salt には英数字、ドット (「.」)、スラッシュ (「/」) から構成される、 2 バイト以上の文字列を指定します。

...るための鍵となる文字列。
英数字・「.」・「/」のいずれかで構成される 2 バイト以上の文字列

//emlist[例][ruby]{
# パスワードの暗号化
salt = [rand(64),rand(64)].pack("C*").tr("\x00-\x3f","A-Za-z0-9./")
passwd.crypt(salt)

# UNIX のログ...
<< < 1 2 3 > >>