るりまサーチ (Ruby 2.2.0)

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

別のキーワード

  1. io popen
  2. io pipe
  3. io each
  4. io readlines
  5. io each_line

クラス

キーワード

検索結果

IO#eof -> bool (81397.0)

ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。

ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。

f = File.new("testfile")
dummy = f.readlines
f.eof #=> true

自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロックします。

r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。

r, w = IO.pipe
Thre...

IO#eof? -> bool (81397.0)

ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。

ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。

f = File.new("testfile")
dummy = f.readlines
f.eof #=> true

自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロックします。

r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eof? #=> 10秒ブロックしてから true を返す。

r, w = IO.pipe
Thre...

RubyVM::InstructionSequence.of(body) -> RubyVM::InstructionSequence (63754.0)

引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。

引数 body で指定した Proc、Method オブジェクトを元に
RubyVM::InstructionSequence オブジェクトを作成して返します。

@param body Proc、Method オブジェクトを指定します。

例1:irb で実行した場合

# proc
> p = proc { num = 1 + 2 }
> RubyVM::InstructionSequence.of(p)
> # => <RubyVM::InstructionSequence:block in irb_binding@(irb)>

# method
> def ...

IO.binwrite(path, string, offset=nil) -> Integer (63505.0)

path で指定されるファイルを開き、string を書き込み、 閉じます。

path で指定されるファイルを開き、string を書き込み、
閉じます。

ファイルを開くときの mode が "rb:ASCII-8BIT" で、バイナリモードが有効
である点以外は IO.write と同じです。

Kernel.#open と同様 path の先頭が "|" ならば、"|" に続くコマンドを実行し、コマンドの出力を標準出力に書き込みます。

offset を指定するとその位置までシークします。

offset を指定しないと、書き込みの末尾でファイルを
切り捨てます。

@param path ファイル名文字列
@param string 書き込む文字列
@param...

Method#source_location -> [String, Integer] | nil (18343.0)

ソースコードのファイル名と行番号を配列で返します。

ソースコードのファイル名と行番号を配列で返します。

その手続オブジェクトが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。

@see Proc#source_location

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----

require '/tmp/foo'

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source...

絞り込み条件を変える

RubyVM::InstructionSequence#base_label -> String (9061.0)

self が表す命令シーケンスの基本ラベルを返します。

self が表す命令シーケンスの基本ラベルを返します。

例1:irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "h...

RubyVM::InstructionSequence#label -> String (9061.0)

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、
モジュール名などで構成されます。

トップレベルでは "<main>" を返します。self を文字列から作成していた場合
は "<compiled>" を返します。

例1:irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.label
# => "<compiled>"

例2: R...