種類
- 文書 (105)
- 変数 (55)
- インスタンスメソッド (22)
- 定数 (11)
クラス
- BasicObject (22)
- Object (11)
モジュール
- Kernel (55)
キーワード
-
$ INPUT _ RECORD _ SEPARATOR (11) -
$ LAST _ MATCH _ INFO (11) -
$ LAST _ PAREN _ MATCH (11) -
$ RS (11) -
$ ~ (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 0 . 0 (4) - Ruby用語集 (11)
-
instance
_ eval (22) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 8 . 5 feature (11) -
ruby 1
. 9 feature (11) - 制御構造 (11)
検索結果
先頭5件
-
Object
:: DATA -> File (18215.0) -
スクリプトの __END__ プログラムの終り以降をアクセスする File オブジェクト。
...んでおくことができます。
DATA 定数はそのデータ部分にアクセスするための File オブジェクトを保持しています。
__END__ を含まないプログラムにおいては DATA は定義されません。
=== 注意
* DATA.rewind で移動する読みとり......* Kernel.#require や Kernel.#load で
読み込まれたファイルの中であってもそのファイル (__FILE__, d:spec/variables#pseudo)
ではなく実行されたファイル ($0) を指します。
=== 例1
print DATA.gets # => 故人西辞黄鶴楼
print DATA.get......揚州
print DATA.gets # => 孤帆遠影碧空尽
print DATA.gets # => 唯見長江天際流
DATA.gets # => nil
__END__
故人西辞黄鶴楼
烟花三月下揚州
孤帆遠影碧空尽
唯見長江天際流
=== 例2
sum = 0
DATA.each_line do |line... -
Kernel
$ $ LAST _ MATCH _ INFO -> MatchData | nil (9100.0) -
$~ の別名
$~ の別名
require "English"
str = "<a href=https://www.ruby-lang.org/en/about/license.txt>license</a>"
if /<a href=(.+?)>/ =~ str
p $LAST_MATCH_INFO[0] #=> "<a href=https://www.ruby-lang.org/en/about/license.txt>"
p $LAST_MATCH_INFO[1] #=> "https://www.ruby-lang.org/en/about/license.t... -
Kernel
$ $ ~ -> MatchData | nil (9100.0) -
現在のスコープで最後に成功したマッチに関する MatchDataオブジェクトです。 Regexp.last_match の別名です。
...現在のスコープで最後に成功したマッチに関する MatchDataオブジェクトです。
Regexp.last_match の別名です。
このデータから n 番目のマッチ ($n) を取り出すためには $~[n] を使います。
この値に代入すると Regexp.last_match や、 $&......, $1, $2, ... などの関連する組み込み変数の値が変化します。
MatchData オブジェクトでも nil でもない値を代入しようとすると TypeError が発生します。
この変数はローカルスコープかつスレッドローカルです。
Ruby起動時の初期... -
Kernel
$ $ INPUT _ RECORD _ SEPARATOR -> String | nil (9006.0) -
$/ の別名
...$/ の別名
require "English"
$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end
p array #=> ["ugo|", "ego|", "fogo\n"]
__END__
ugo|ego|fogo... -
Kernel
$ $ LAST _ PAREN _ MATCH -> String | nil (9006.0) -
$+ の別名
...別名
require "English"
r1 = Regexp.compile("<img src=(http:.+?)>")
r2 = Regexp.compile("<a href=(http|ftp).+?>(.+?)</a>")
while line = DATA.gets
[ r1, r2 ].each {|rep|
rep =~ line
p $+
}
end
__END__
<tr> <td><img src=http://localhost/a.jpg></td> <td>ikkou</td>... -
Kernel
$ $ RS -> String | nil (9006.0) -
$/ の別名
...$/ の別名
require "English"
$INPUT_RECORD_SEPARATOR = '|'
array = []
while line = DATA.gets
array << line
end
p array #=> ["ugo|", "ego|", "fogo\n"]
__END__
ugo|ego|fogo... -
NEWS for Ruby 3
. 0 . 0 (114.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...*
* Can be sliced with Enumerator::ArithmeticSequence
//emlist[][ruby]{
dirty_data = ['--', 'data1', '--', 'data2', '--', 'data3']
dirty_data[(1..).step(2)] # take each second element
# => ["data1", "data2", "data3"]
//}
* Binding
* Binding#eval when called with one argument will use `"(......wait(io, events, timeout)` in a non-blocking execution context. 16786
* Kernel
* Kernel#clone when called with the `freeze: false` keyword will call `#initialize_clone` with the `freeze: false` keyword. 14266
* Kernel#clone when called with the `freeze: true` keyword will call `#initialize......s unfrozen. 16175
* Kernel#eval when called with two arguments will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352
* Kernel#lambda now warns if called without a literal block. 15973
* Kernel.sleep invokes the scheduler hook `#kernel_sleep(...)` in a non-... -
NEWS for Ruby 2
. 0 . 0 (108.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...を導入しました。期待しないスタックオーバーフローを避けるためです
* GC::Profiler
* 追加: GC::Profiler.raw_data GCの加工していないプロファイルデータを返します
* Hash
* 追加: Hash#to_h 明示的に変換するメソッドです。A......ts
* Kernel
* 追加: Kernel.#Hash という変換メソッド。Kernel.#Array, Kernel.#Float に似ています
* 追加: Kernel.#__dir__ 現在のソースファイル(__FILE__)のあるディレクトリ名を正規化された絶対パ スで返します。
* 追加: Kernel.#calle......r_locations フレーム情報の配列を返します
* 拡張: Kernel.#warn Kernel.#puts のように複数の引数を受け付けるようになりました
* 拡張: Kernel.#caller 第2引数で取得するスタックのサイズを指定できるようになりました
* 拡張:... -
ruby 1
. 8 . 4 feature (48.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...from Kernel method.
#
# * eval.c (exec_under): frame during eval should preserve external
# information.
: super [bug]
Kernelのメソッド内でsuperを呼んだ時に、存在しないsuperclass
にアクセスしようとするバグの修正。
module Kernel......グの修正。((<ruby-dev:27331>))
: IO [bug]
#Wed Sep 28 08:12:18 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
#
# * io.c (read_buffered_data): check if reached EOF. fixed: [ruby-dev:27334]
Solaris(64bit?)などでEOF後にゴミを読み出すことがあったバグを修正。......れました.
# * ext/tk/lib/tk/event.rb: add :data key for virtual events [Tk8.5
# feature].
#
Tcl/Tk8.5 への対応のため,仮想イベントのイベント情報の一つである data
キーの情報を :data で指定できるようになりました.
#Fri Nov... -
制御構造 (48.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...左辺の式が begin 節である場合にはそれを最初に一回評価してから繰り返します。
//emlist[例][ruby]{
send_request(data)
begin
res = get_response()
end while res == 'Continue'
//}
while 修飾した式は nil を返します。
また、引数を伴った break に......左辺の式が begin 節である場合にはそれを最初に一回評価してから繰り返します。
//emlist[例][ruby]{
send_request(data)
begin
res = get_response()
end until res == 'OK'
//}
until 修飾した式は nil を返します。
また、引数を伴った break により......一引数で指定された例外を、第二引数をメッセージとして発生さ
せます。第四の形式の第三引数は
$@または
Kernel.#callerで得られる
スタック情報で、例外が発生した場所を示します。
発生した例外は後述の begin 式の rescue...