るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 3 >>

Enumerable#each_with_index(*args) {|item, index| ... } -> self (9231.0)

要素とそのインデックスをブロックに渡して繰り返します。

...デックスを繰り返すような
Enumerator を返します。

Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@param args イテレータメソッド (each な...
...す。

//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
r
equire 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["b...
...az", 2]
//}

@see Enumerator#with_index...

IO#pread(maxlen, offset, outbuf = "") -> string (6320.0)

preadシステムコールを使ってファイルポインタを変更せずに、また現在のファイルポインタに 依存せずにmaxlenバイト読み込みます。

...preadシステムコールを使ってファイルポインタを変更せずに、また現在のファイルポインタに
依存せずにmaxlenバイト読み込みます。

IO#seekとIO#readの組み合わせと比べて、アトミックな操作に
なるという点が優れていて、複...
...イパスします。

@param maxlen 読み込むバイト数を指定します。
@param offset 読み込み開始位置のファイルの先頭からのオフセットを指定します。
@param outbuf データを受け取る String を指定します。

@raise Errno::EXXX シークまたは書...
...
@raise EOFError EOF に到達した時に発生します。
@raise NotImplementedError システムコールがサポートされていない OS で発生します。

//emlist[例][ruby]{
File.write("testfile", "This is line one\nThis is line two\n")
File.open("testfile") do |f|
p f.read...

Struct#[](member) -> object (6219.0)

構造体のメンバの値を返します。

...

@param member Integer でメンバのインデックスを指定します。
Symbol, String でメンバの名前を指定します。

@raise IndexError member が整数で存在しないメンバを指定した場合に発生します。

@raise NameError member が String, Symb...
...//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
obj = Foo.new('FOO', 'BAR')
p obj[:foo] # => "FOO"
p obj['bar'] # => "BAR"
# p obj[:baz] # => in `[]': no member 'baz' in struct (NameError)
p obj[0] # => "FOO"
p obj[1] # => "BAR"
p obj[-1] # => "BAR" # Array の...
...きます。
p obj[2] # => in `[]': offset 2 too large for struct(size:2) (IndexError)
//}

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に...

CSV::Row#[]=(header, offset, value) (3315.0)

ヘッダの名前でフィールドを探し、値をセットします。

...トします。

@param header ヘッダの名前を指定します。

@param offset このインデックスより後で、ヘッダの名前を探します。
重複しているヘッダがある場合に便利です。

@param value 値を指定します。

@see CSV::Row#field...
<< < 1 2 3 >>