るりまサーチ

最速Rubyリファレンスマニュアル検索!
982件ヒット [1-100件を表示] (0.015秒)
トップページ > クエリ:puts[x] > 種類:特異メソッド[x]

別のキーワード

  1. _builtin puts
  2. csv puts
  3. stringio puts
  4. io puts
  5. xmp puts

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Tracer.verbose=(flag) (49.0)

トレース出力の開始や終了を知らせる文字列("Trace on"または"Trace off")が必要なら真を設定します。

...r.on {
puts
"Hello"
}

# 出力例
Trace on
#0:t5.rb:7::-: puts "Hello"
#0:t5.rb:7:Kernel:>: puts "Hello"
#0:t5.rb:7:IO:>: puts "Hello"
Hello#0:t5.rb:7:IO:<: puts "Hello"
#0:t5.rb:7:IO:>: puts "Hello"

#0:t5.rb:7:IO:<: puts "Hello"
#0:t5.rb:7:Kernel:<: puts "Hel...

Dir.mktmpdir(prefix_suffix = nil, tmpdir = nil) -> String (43.0)

一時ディレクトリを作成します。

...ディレクトリを使用します。


使用例
require 'tmpdir'

puts
Dir.tmpdir
# 出力例: 動作環境により出力は異なります。
#=> /cygdrive/c/DOCUME~1/kouya/LOCALS~1/Temp
Dir.mktmpdir{|dir|
puts
dir
# 出力例: 一時ディレクトリ の名前の先頭に'...
...ir|
puts
dir
# 出力例:一時ディレクトリ の名前の先頭に'foo' をつける。
#=> /cygdrive/c/DOCUME~1/kouya/LOCALS~1/Temp/foo20081011-4824-pjvhwx
# ^^^
}
Dir.mktmpdir(["foo", "bar"]){|dir|
puts
di...
...0081011-5624-1hyxrqbbar
# ^^^ ^^^
}

Dir.mktmpdir(nil, "/var/tmp") {|dir|
puts
dir
# 出力例: tmpdir の作成先が'/var/tmp'となる。
# さらに、一時ディレクトリ の名前の先頭に'd'...

Dir.mktmpdir(prefix_suffix = nil, tmpdir = nil) {|dir| ... } -> object (43.0)

一時ディレクトリを作成します。

...ディレクトリを使用します。


使用例
require 'tmpdir'

puts
Dir.tmpdir
# 出力例: 動作環境により出力は異なります。
#=> /cygdrive/c/DOCUME~1/kouya/LOCALS~1/Temp
Dir.mktmpdir{|dir|
puts
dir
# 出力例: 一時ディレクトリ の名前の先頭に'...
...ir|
puts
dir
# 出力例:一時ディレクトリ の名前の先頭に'foo' をつける。
#=> /cygdrive/c/DOCUME~1/kouya/LOCALS~1/Temp/foo20081011-4824-pjvhwx
# ^^^
}
Dir.mktmpdir(["foo", "bar"]){|dir|
puts
di...
...0081011-5624-1hyxrqbbar
# ^^^ ^^^
}

Dir.mktmpdir(nil, "/var/tmp") {|dir|
puts
dir
# 出力例: tmpdir の作成先が'/var/tmp'となる。
# さらに、一時ディレクトリ の名前の先頭に'd'...

WIN32OLE_TYPELIB.new(libname, mjv = nil, miv = nil) -> WIN32OLE_TYPELIB (31.0)

WIN32OLE_TYPELIBオブジェクトを生成します。

...M32\\SHELL32.DLL")
puts
tlib1.name # => 'Microsoft Excel 14.0 Object Library'
puts
tlib2.name # => 'Microsoft Excel 14.0 Object Library'
puts
tlib3.name # => 'Microsoft Excel 14.0 Object Library'
puts
tlib4.name # => 'Microsoft Excel 14.0 Object Library'
puts
tlib5.name # =>...

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

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

...oc、Method オブジェクトを指定します。

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

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

出力:

== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| c...
...up
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@/tmp/method.rb>======...
...( 1)
0002 trace 1 ( 2)
0004 putself
0005 putstring "hello, world"
0007 send :puts, 1, nil, 8, <ic:0>
0013 trace 16 ( 3)
0015 leave...

絞り込み条件を変える

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

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

...oc、Method オブジェクトを指定します。

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

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

出力:

== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| c...
...up
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@/tmp/method.rb>======...
...( 1)
0002 trace 1 ( 2)
0004 putself
0005 putstring "hello, world"
0007 send :puts, 1, nil, 8, <ic:0>
0013 trace 16 ( 3)
0015 leave...

WIN32OLE.const_load(ole, mod = WIN32OLE) -> () (25.0)

OLEオートメーションサーバが保持する定数を読み込み、指定されたモジュール に組み込みます。

...el.Application')
WIN32OLE.const_load(excel, EXCEL_CONST)
puts
EXCEL_CONST::XlTop # => -4160
puts
EXCEL_CONST::CONSTANTS['_xlDialogChartSourceData'] # => 541

モジュール名を省略した例

WIN32OLE.const_load(excel)
puts
WIN32OLE::XlTop # => -4160

タイプライブラリ名...
...を指定した例

module MSO
end

WIN32OLE.const_load('Microsoft Office 9.0 Object Library', MSO)
puts
MSO::MsoLineSingle # => 1...

IO.popen("-", mode = "r", opt={}) -> IO (21.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...ロセスでは IO オブジェクトを返し、子プロセスでは
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit...
...引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts
"child output: " + s
end
}
# => "child output: foo\n"

opt ではエンコーディングの設定やプ...

IO.popen("-", mode = "r", opt={}) {|io| ... } -> object (21.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...ロセスでは IO オブジェクトを返し、子プロセスでは
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit...
...引数にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts
"child output: " + s
end
}
# => "child output: foo\n"

opt ではエンコーディングの設定やプ...
<< 1 2 3 ... > >>