クラス
-
ARGF
. class (192) - Array (72)
- BasicObject (24)
- Binding (12)
- Complex (24)
- Enumerator (12)
- Exception (24)
- File (36)
- IO (468)
- LoadError (12)
- Method (12)
- Module (180)
- Object (192)
- Proc (19)
- Random (103)
- Rational (12)
- String (72)
- SystemExit (12)
- Thread (96)
-
Thread
:: Backtrace :: Location (12) - TracePoint (12)
- UnboundMethod (24)
- UncaughtThrowError (22)
キーワード
-
$ ! (12) -
$ " (12) -
$ $ (12) -
$ & (12) -
$ & # 39; (12) -
$ * (12) -
$ + (12) -
$ , (12) -
$ -0 (12) -
$ -F (12) -
$ -I (12) -
$ -K (12) -
$ -W (12) -
$ -a (12) -
$ -d (12) -
$ -i (12) -
$ -l (12) -
$ -p (12) -
$ -v (12) -
$ -w (12) -
$ . (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) -
$ < (12) -
$ = (12) -
$ > (12) -
$ ? (12) -
$ @ (12) -
$ DEBUG (12) -
$ FILENAME (12) -
$ KCODE (12) -
$ LOADED _ FEATURES (12) -
$ LOAD _ PATH (12) -
$ PROGRAM _ NAME (12) -
$ SAFE (12) -
$ VERBOSE (12) -
$ \ (12) -
$ _ (12) -
$ ` (12) -
$ stderr (12) -
$ stdin (12) -
$ stdout (12) -
$ ~ (12) - % (12)
- ARGF (24)
- Array (12)
- BasicObject (12)
- Binding (12)
- Complex (36)
- DATA (12)
- DEFAULT (7)
- File (12)
- Float (12)
- Hash (12)
- Integer (12)
- LoadError (12)
- Location (12)
- Proc (12)
- Rational (24)
- RuntimeError (12)
-
SCRIPT
_ LINES _ _ (12) - String (12)
- ThreadError (12)
- TracePoint (12)
- UncaughtThrowError (11)
-
_ _ callee _ _ (12) -
_ _ dir _ _ (12) -
_ _ method _ _ (12) - ` (12)
- abort (48)
-
add
_ trace _ func (12) -
alias
_ method (12) - ancestors (12)
-
at
_ exit (12) - autoload (24)
- autoload? (24)
-
backtrace
_ locations (24) -
bind
_ call (12) - binding (12)
- binread (12)
- binwrite (12)
-
block
_ given? (12) - caller (36)
-
caller
_ locations (24) - catch (24)
- chomp (12)
- chop (12)
- class (12)
-
class
_ eval (24) -
class
_ variables (12) -
const
_ defined? (12) - constants (24)
- convert (12)
-
defined
_ class (12) - eval (36)
- exception (24)
- exec (48)
- exit (36)
- exit! (24)
- fail (36)
-
for
_ fd (12) - foreach (24)
- fork (48)
- format (12)
- freeze (12)
- gets (48)
-
global
_ variables (12) - gsub (36)
- hex (12)
- identical? (12)
- include (12)
- inspect (12)
-
instance
_ eval (24) -
instance
_ variables (12) - iterator? (12)
- kill (24)
- lambda (18)
- load (12)
-
local
_ variables (12) - loop (24)
- method (12)
-
module
_ eval (24) - new (43)
- next (12)
- oct (12)
- open (72)
- owner (24)
- p (12)
- path (12)
- popen (168)
- pp (8)
- print (36)
- printf (48)
- proc (19)
-
public
_ instance _ method (12) - putc (36)
- puts (36)
- raise (48)
- rand (96)
- read (36)
- readline (48)
- readlines (84)
- rect (12)
- rectangular (12)
-
remove
_ const (12) - reopen (36)
- require (12)
-
require
_ relative (12) - sample (48)
- select (24)
- send (24)
-
set
_ trace _ func (24) - shuffle! (24)
-
singleton
_ method (12) - sleep (24)
- spawn (60)
- sprintf (12)
- srand (48)
- status (12)
- sub (24)
- syscall (12)
- sysopen (12)
- system (48)
- tag (11)
- terminate (12)
- test (24)
- throw (12)
-
to
_ a (48) -
to
_ ary (12) -
to
_ f (12) -
to
_ i (12) -
to
_ int (12) -
to
_ r (12) -
to
_ s (24) -
to
_ str (12) -
trace
_ var (36) - trap (24)
-
untrace
_ var (12) - value (11)
- warn (30)
- write (24)
検索結果
先頭5件
-
Kernel (38002.0)
-
全てのクラスから参照できるメソッドを定義しているモジュール。 Object クラスはこのモジュールをインクルードしています。
全てのクラスから参照できるメソッドを定義しているモジュール。
Object クラスはこのモジュールをインクルードしています。
Object クラスのメソッドは実際にはこのモジュールで定義されていま
す。これはトップレベルでのメソッドの再定義に対応するためです。 -
Kernel
$ $ _ -> String | nil (21058.0) -
最後に Kernel.#gets または Kernel.#readline で読み込んだ文字列です。 EOF に達した場合には、 nil になります。 (覚え方: Perlと同じ)
...最後に Kernel.#gets または Kernel.#readline で読み込んだ文字列です。
EOF に達した場合には、 nil になります。
(覚え方: Perlと同じ)
Kernel.#print のような Perl 由来の幾つかのメソッドは、引数を省略すると代わりに $_ を利用します......。
この変数はローカルスコープかつスレッドローカルです。
Ruby起動時の初期値は nil です。
@see Kernel.#print, Kernel.#gets, Kernel.#readline, Object::ARGF
=== 例
example.txt:
foo
bar
baz
このとき、コマンド ruby -e 'print while gets' example.txt... -
Kernel
. # exec(env , program , *args , options={}) -> () (21038.0) -
引数で指定されたコマンドを実行します。
...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。
=== 引数の解釈
この形式で呼び出した場合、空白や shell のメタキャラクタも
そ......替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep
@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)... -
Kernel
. # exec(program , *args , options={}) -> () (21038.0) -
引数で指定されたコマンドを実行します。
...イルデスクリプタなど)引き継ぎます。
Hash を options として渡すことで、この挙動を変更できます。
詳しくは Kernel.#spawn を参照してください。
=== 引数の解釈
この形式で呼び出した場合、空白や shell のメタキャラクタも
そ......替えて以下を実行
$ ps aux|grep sleep
xxxx 32754 0.0 0.0 2580 468 pts/3 S+ 22:01 0:00 mysleep 600
xxxx 32761 0.0 0.0 2824 792 pts/6 S+ 22:01 0:00 grep sleep
@see Kernel.#system,Kernel.#`,Kernel.#spawn,Kernel.#fork,IO.popen,IO.pipe,Kernel.#open,exec(3)... -
Kernel
. # exit!(status = false) -> () (21032.0) -
Rubyプログラムの実行を即座に終了します。 status として整数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。 デフォルトの終了ステータスは 1 です。
...XIT_FAILURE の値なので、正確には環境依存です。
exit! は exit とは違って、例外処理などは一切行ないませ
ん。 Kernel.#fork の後、子プロセスを終了させる時などに用
いられます。
@param status 終了ステータスを整数か true また......T.sync = true #表示前に終了しないようにする
puts 'start'
begin
puts 'start1...'
exit!
ensure
puts 'end1...' #実行されない
end
puts 'end' #実行されない
#=> start
# start1...
#終了ステータス:1
//}
@see Kernel.#exit,Kernel.#abort,Kernel.#at_exit,Kernel.#fork... -
Kernel
. # autoload(const _ name , feature) -> nil (21030.0) -
定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。
...定数 const_name を最初に参照した時に feature を
Kernel.#require するように設定します。
const_name には、 "::" 演算子を含めることはできません。
ネストした定数を指定する方法は Module#autoload を参照してください。
const_name が aut......対象を指定します。
@raise LoadError featureのロードに失敗すると発生します。
//emlist[][ruby]{
# ------- /tmp/foo.rb ---------
class Bar
end
# ----- end of /tmp/foo.rb ----
autoload :Bar, '/tmp/foo'
p Bar #=> Bar
//}
@see Kernel.#autoload?,Module#autoload,Kernel.#require... -
Kernel
. # catch {|tag| . . . . } -> object (21030.0) -
Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
...
Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック......@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。
//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j in 1..2
for k in 1..2
throw tag, k
end
end
end
end
p result #=> 1
//}
@see Kernel.#throw... -
Kernel
. # catch(tag) {|tag| . . . . } -> object (21030.0) -
Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
...
Kernel.#throwとの組み合わせで大域脱出を行います。 catch はブロックを実行します。
ブロックの実行中に tag と同一のオブジェクトを引数とする Kernel.#throw が行われた
場合は、その throw の第二引数を戻り値として、ブロック......@return ブロックの返り値か、対応するthrowの第二引数を返り値として返します。
//emlist[例][ruby]{
result = catch do |tag|
for i in 1..2
for j in 1..2
for k in 1..2
throw tag, k
end
end
end
end
p result #=> 1
//}
@see Kernel.#throw... -
Kernel
. # readlines(rs = $ / ) -> [String] (21030.0) -
ARGFを Kernel.#gets(rs) でEOFまで読み込んで、その各行を要素としてもつ配列を返します。 行の区切りは引数 rs で指定した文字列になります。
...ARGFを Kernel.#gets(rs) でEOFまで読み込んで、その各行を要素としてもつ配列を返します。
行の区切りは引数 rs で指定した文字列になります。
rs に nil を指定すると行区切りなしとみなします。
空文字列 "" を指定すると連続......s("") #=> ["hello\nit\n\n", "common\n", "hello\nit\n\n", "common\n"]
ARGV << 'b.txt' << 'b.txt'
p readlines('it') #=> ["hello\nit", "\n\ncommon\n", "hello\nit", "\n\ncommon\n"]
p readlines #=> []
//}
//emlist[b.txt][ruby]{
hello
it
common
//}
@see $/,ARGF,Kernel.#gets, Kernel.#readline...