別のキーワード
種類
- 変数 (456)
- モジュール関数 (302)
- インスタンスメソッド (12)
キーワード
-
$ & (12) -
$ & # 39; (12) -
$ * (12) -
$ , (12) -
$ -0 (12) -
$ -F (12) -
$ -I (12) -
$ / (12) -
$ 0 (12) -
$ 1 (12) -
$ 10 (12) -
$ 11 (12) -
$ 2 (12) -
$ 3 (12) -
$ 4 (12) -
$ 5 (12) -
$ 6 (12) -
$ 7 (12) -
$ 8 (12) -
$ 9 (12) -
$ : (12) -
$ ; (12) -
$ ARGV (12) -
$ LAST _ PAREN _ MATCH (12) -
$ LAST _ READ _ LINE (12) -
$ LOAD _ PATH (12) -
$ ORS (12) -
$ OUTPUT _ RECORD _ SEPARATOR (12) -
$ PROGRAM _ NAME (12) -
$ _ (12) -
$ ` (12) -
$ archdir (12) -
$ hdrdir (12) -
$ libdir (12) -
$ sitearchdir (12) -
$ sitelibdir (12) -
$ srcdir (12) -
$ topdir (12) - Float (12)
- Integer (12)
- ` (12)
-
arg
_ config (12) - autoload (12)
- autoload? (12)
- caller (36)
- chomp (12)
- chop (12)
- format (12)
- gets (12)
- gsub (36)
- open (2)
- readline (12)
- readlines (12)
- sprintf (12)
- sub (24)
-
trace
_ var (36) -
untrace
_ var (12)
検索結果
先頭5件
-
Kernel
$ $ * -> [String] (146.0) -
Rubyスクリプトに与えられた引数を表す配列です。 組み込み定数 Object::ARGV の別名です。
...
Rubyスクリプトに与えられた引数を表す配列です。
組み込み定数 Object::ARGV の別名です。
Ruby 自身に対する引数は取り除かれています。
この変数はグローバルスコープです。... -
Kernel
. # caller(range) -> [String] | nil (140.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...am range 取得したいスタックの範囲を示す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
b......nil
//}
以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。
//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end......=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # caller(start = 1) -> [String] | nil (140.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...am range 取得したいスタックの範囲を示す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
b......nil
//}
以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。
//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end......=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # caller(start , length) -> [String] | nil (140.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...am range 取得したいスタックの範囲を示す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
b......nil
//}
以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。
//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end......=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # `(command) -> String (138.0) -
command を外部コマンドとして実行し、その標準出力を文字列として 返します。このメソッドは `command` の形式で呼ばれます。
...タスを得るには、$? を参照します。
コマンドの出力を得る必要がなく、単にコマンドを実行したいだけなら
Kernel.#system を使います。特に端末を制御するコマンドでは
`command` は失敗するかもしれません。
d:spec/literal#command......Errno::EXXX コマンドを実行できないときや失敗した場合に発生します。
//emlist[例][ruby]{
puts `ruby -v` #=> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
puts $?.inspect #=> #<Process::Status: pid=3580,exited(0)>
//}
@see Kernel.#system,Kernel.#exec,Kernel.#spawn... -
Kernel
. # gets(rs = $ / ) -> String | nil (138.0) -
ARGFから一行読み込んで、それを返します。 行の区切りは引数 rs で指定した文字列になります。
...り(EOF)に到達した時、 nil を返します。
@raise Errno::EXXX 読み込みに失敗した場合に発生します。
//emlist[main.rb][ruby]{
ARGV << 'b.txt' << 'c.txt'
p gets #=> "hello\n"
p gets(nil) #=> "it\ncommon\n"
p gets("") #=> "ARGF\n\n"
p gets('、') #=> "# スクリプトに指.......txt][ruby]{
hello
it
common
//}
//emlist[c.txt][ruby]{
ARGF
# スクリプトに指定した引数 (Object::ARGV を参照) をファイル名と
# みなして、それらのファイルを連結した 1 つの仮想ファイルを表すオブジェクトです。
//}
@see $/,ARGF,Kernel.#read......lines,Kernel.#readline... -
Kernel
$ $ archdir -> String (134.0) -
マシン固有のライブラリを置くディレクトリです。 通常は "/usr/local/lib/ruby/バージョン/arch" です。
...マシン固有のライブラリを置くディレクトリです。
通常は "/usr/local/lib/ruby/バージョン/arch" です。... -
Kernel
$ $ srcdir -> String (134.0) -
Ruby インタプリタを make したときのソースディレクトリです。
...
Ruby インタプリタを make したときのソースディレクトリです。... -
Kernel
$ $ topdir -> String (134.0) -
拡張ライブラリを make するためのヘッダファイル、 ライブラリ等が存在するディレクトリです。 通常は $archdir と同じで、"/usr/local/lib/ruby/バージョン/arch" です。
...拡張ライブラリを make するためのヘッダファイル、
ライブラリ等が存在するディレクトリです。
通常は $archdir と同じで、"/usr/local/lib/ruby/バージョン/arch" です。...