るりまサーチ

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

別のキーワード

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

モジュール

キーワード

検索結果

<< 1 2 > >>

IO#dup -> IO (24325.0)

レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。

...同じ IO を参照する新しい IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。

clone の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、
dup
は内...
...しいフリーズされていない IO を返します。

@raise IOError 既に close されていた場合に発生します。

//emlist[例][ruby]{
clone_io = nil
IO
.write("testfile", "test")
File.open("testfile") do |io|
clone_io = io.clone
end
clone_io.read # => "test"
clone_io.close
//}...

IO#clone -> IO (9225.0)

レシーバと同じ IO を参照する新しい IO オブジェクトを返します。 参照しているファイル記述子は dup(2) されます。

...同じ IO を参照する新しい IO オブジェクトを返します。
参照しているファイル記述子は dup(2) されます。

clone の際に self は一旦 IO#flush されます。
フリーズした IO の clone は同様にフリーズされた IO を返しますが、
dup
は内...
...しいフリーズされていない IO を返します。

@raise IOError 既に close されていた場合に発生します。

//emlist[例][ruby]{
clone_io = nil
IO
.write("testfile", "test")
File.open("testfile") do |io|
clone_io = io.clone
end
clone_io.read # => "test"
clone_io.close
//}...

RubyVM::InstructionSequence#to_a -> Array (3008.0)

self の情報を 14 要素の配列にして返します。

...す。

: magic

データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。

: major_version

命令シーケンスのメジャーバージョン。

: minor_version

命令シーケンスのマイナーバージョン。

: format_type

データ...
...gs

引数の指定が必須のメソッド、ブロックの引数の個数。あるいは以下のよう
な配列。

[required_argc, [optional_arg_labels, ...],
splat_index, post_splat_argc, post_splat_index,
block_index, simple]

より詳細な情報については、vm_cor...
...オペランドの配列の配列。


//emlist[例][ruby]{
require 'pp'

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
pp iseq.to_a
# ※ Ruby 2.5.0 での実行結果
# => ["YARVInstructionSequence/SimpleDataFormat",
# 2,
# 0,
# 1,
# {:arg_size=>0, :local_size=>2, :stack_max=>2},
# "<c...

RubyVM::InstructionSequence.disasm(body) -> String (3008.0)

引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。

...structionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。

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

例1:Proc オブジェクトを指定した場合

# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::InstructionSequ...
...ence.disasm(p)

出力:

== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 cont: 0012
|----------------------------------------------------------...
...<ic:1>
0008 dup
0009 setlocal num, 0
0012 leave

例2:Method オブジェクトを指定した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

puts RubyVM::InstructionSequence.disasm(method(:hello))

出力:

== disasm: <RubyVM::InstructionSequence:hello@/...

RubyVM::InstructionSequence.disassemble(body) -> String (3008.0)

引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。

...structionSequence オブジェクトを人間が読める形式の文字
列に変換して返します。

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

例1:Proc オブジェクトを指定した場合

# /tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::InstructionSequ...
...ence.disasm(p)

出力:

== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 cont: 0012
|----------------------------------------------------------...
...<ic:1>
0008 dup
0009 setlocal num, 0
0012 leave

例2:Method オブジェクトを指定した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

puts RubyVM::InstructionSequence.disasm(method(:hello))

出力:

== disasm: <RubyVM::InstructionSequence:hello@/...

絞り込み条件を変える

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, options) -> Symbol (408.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...tion_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

optio...
...stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_fu...
...case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefined_conversion
c = ec.primitive_errinfo[3].dup.force_encoding(ec.primitive_errinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (308.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...tion_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

optio...
...stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_fu...
...case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefined_conversion
c = ec.primitive_errinfo[3].dup.force_encoding(ec.primitive_errinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (208.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...tion_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

optio...
...stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_fu...
...case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefined_conversion
c = ec.primitive_errinfo[3].dup.force_encoding(ec.primitive_errinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer) -> Symbol (108.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...tion_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

optio...
...stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_fu...
...case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
redo
when :undefined_conversion
c = ec.primitive_errinfo[3].dup.force_encoding(ec.primitive_errinfo[1])
ec.insert_output('\x{%X:%s}' % [c.ord, c.encoding])
redo
when :incomplete_input...

Kernel$$stdin -> object (20.0)

標準入力です。

...d, fileno, to_io, eof, each_line, each_byte,
binmode, closed?

//emlist[例][ruby]{
$stdin = Object.new
def $stdin.gets
"foo"
end
p gets() # => "foo"
//}

自プロセスだけでなく、子プロセスの標準入力もリダイレクトしたいときは
以下のように IO#reopen を使...
...リダイレクトしたあと
出力先をまた元に戻したい場合は以下のようにします。

//emlist[例][ruby]{
stdin_old = $stdin.dup # 元の $stdin を保存する
$stdout.reopen("/tmp/foo") # $stdin を /tmp/foo にリダイレクトする
gets #...

絞り込み条件を変える

<< 1 2 > >>