別のキーワード
クラス
-
ARGF
. class (24) - Array (24)
- Binding (11)
- Coverage (7)
- Enumerator (36)
-
Enumerator
:: Lazy (48) - Float (22)
- Integer (72)
- Object (48)
-
Rake
:: FileTask (12) - String (12)
-
Thread
:: ConditionVariable (24)
キーワード
- * (36)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - Fiber (12)
-
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (5) - Numeric (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Rubyの起動 (12)
- Symbol (1)
-
at
_ exit (12) - benchmark (12)
- bigdecimal (12)
- bm (12)
- broadcast (12)
- coverage (12)
- downto (24)
-
enum
_ for (48) - eof (12)
- eof? (12)
-
line
_ stub (7) -
local
_ variables (11) - measure (12)
- next (12)
-
next
_ float (11) -
prev
_ float (11) - signal (12)
-
to
_ enum (48) - upto (24)
-
with
_ object (24) - xmlrpc (3)
- クラス/メソッドの定義 (12)
- 制御構造 (12)
- 変数と定数 (12)
- 演算子式 (12)
検索結果
先頭5件
-
Integer
# times -> Enumerator (18126.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...0 から self - 1 までの数値が渡されます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see In... -
Integer
# times {|n| . . . } -> self (18126.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...0 から self - 1 までの数値が渡されます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see In... -
Rubyの起動 (6273.0)
-
Rubyの起動 * cmd_option * shebang
...Rubyの起動
* cmd_option
* shebang
Rubyインタプリタの起動は以下の書式のコマンドラインにより行います。
ruby [ option ...] [ -- ] [ programfile ] [ argument ...]
ここで、option は後述のcmd_option
のいずれかを指定します。-- は、オプシ......ョン列の終りを明示するため
に使用できます。programfile は、Ruby スクリプトを記述したファイ
ルです。これを省略したり`-' を指定した場合には標準入力を Ruby ス
クリプトとみなします。
programfile が `#!' で始まるファイル......の間に改行を
挟んで解釈します。
//emlist{
以下は等価です。
ruby -e "5.times do |i|" -e "puts i" -e "end"
ruby -e "5.times do |i|
puts i
end"
ruby -e "5.times do |i|; puts i; end"
//}
: -Fregexp
入力フィールドセパレータ($;)に regex... -
Rake
:: FileTask # timestamp -> Time | Rake :: LateTime (6106.0) -
ファイルタスクのタイムスタンプを返します。
...ファイルタスクのタイムスタンプを返します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: "test.txt"
file "test.txt" do |task|
Rake.application.options.build_all = false
task.timestamp # => #<Rake::LateTime:0x2ba58f0>
end
//}... -
NEWS for Ruby 3
. 0 . 0 (3195.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 3.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{......partitioning cold paths.
* Instance variables
* Eliminate some redundant checks.
* Skip checking a class and a object multiple times in a method when possible.
* Optimize accesses in some core classes like Hash and their subclasses.
* Method inlining support for some... -
NEWS for Ruby 2
. 5 . 0 (3147.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.5.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......トは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.4.0 以降の変更
=== 言語仕様の変更
* トップレベルの定数参照を削除しました 11547
* do/end ブロック内部で rescue/else/ensure を書けるようになりまし......りました。
coerceがnilを返す場合、変換は不可能です。7688
* Process
* getrusage(2) が存在する場合 Process.#times の精度を改良しました 11952
* Process.last_status を追加。$? と同じです 14043
* Range
* Range.new no longer hides exce... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (3087.0)
-
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or plus minus ast slash hat sq period comma langl rangl eq tilde dollar at under lbrarbra lbra2rbra2 lbra3rbra3 dq colon ac backslash semicolon
...Rubyで使われる記号の意味(正規表現の複雑な記号は除く)
ex q num per and or
plus minus ast slash hat sq
period comma langl rangl eq tilde
dollar at under lbrarbra
lbra2rbra2 lbra3rbra3 dq colon ac
backslash semicol......#! ruby -Ks
shebang。d:spec/rubycmd#shebangを参照。
: # coding: utf-8
マジックコメント。d:spec/m17n#magic_comment を参照。
: "a is #{a}"
d:spec/literal#exp
//emlist{
a = 10
p "a is #{a}" #=> "a is 10"
//}
: Range#each
説明文の中でのみ使われます。Ruby......なら a に xxx を代入する、という意味になります。
//emlist{
a ||= :some
p a #=> some
a ||= :sec
p a #=> some
//}
: 5.times{|n| p n}
ブロックパラメータであることを示す区切り文字。
: /xx(xx|xx)/
正規表現の選択
===[a:plus] +
: 2 + 3... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (1428.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...動作はなくなりました)
$defout や $deferr に代入を行うと警告がでます。
(注:1.6 に $deferr はありません)
((<ruby-dev:20961>))
$stdin にオブジェクトを代入すると標準入力からの入力メソッド(gets 等)
はそのオブジェクトにメ......オプションは $VERBOSE = nil の指定(-W0)を可能にします。
: ruby interpreter [ruby] [change]
クラスの特異クラスの特異クラスは特異クラス自身であると定義されました
((<ruby-bugs-ja:313>))。なんだかよくわかりません(^^;
class <......ThreadGroup に Thread を追加/削除できなくなりました。
=== Time
: ((<Process/Process.times>)) [change]
((<Time/Time.times>)) から移動しました。
(Time.times も残っていますが、warningが出ます)
: ((<Time#to_a|Time/to_a>)) [change]
: ((<Time#z... -
制御構造 (288.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...return
* BEGIN
* END
Rubyでは(Cなどとは異なり)制御構造は式であって、何らかの値を返すものが
あります(返さないものもあります。値を返さない式を代入式の右辺に置くと
syntax error になります)。
RubyはC言語やPerlから引......返しを始めとする制御構造をクラス設計者が定義する事が出来るものです.
=== 条件分岐
====[a:if] if
//emlist[例][ruby]{
if age >= 12 then
print "adult fee\n"
else
print "child fee\n"
end
gender = if foo.gender == "male" then "male" else "female" end
//}
文法......END ブロックが登録される
わけではありません。そのような目的には Kernel.#at_exit を使
います。
//emlist[][ruby]{
5.times do |i|
END { p i }
end
# => 0
//}
END をメソッド定義式中に書くと警告が出ます。
意図的にこのようなことを行... -
クラス/メソッドの定義 (270.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...hod
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* defined
===[a:class] クラス定義
//emlist[例][ruby]{
class Foo < Super
def test
# ...
end
# ...
end
//}
文法:
class 識別子 [`<' superclass ]
式..
en......外処理についてはd:spec/control#begin参照。
クラス定義は、識別子で指定した定数へのクラスの代入になります
(Ruby では、クラスもオブジェクトの一つで Classクラスの
インスタンスです)。
クラスが既に定義されているとき、......のブロック引数の値はnilです。
//emlist[例][ruby]{
def foo(cnt, &block_arg)
cnt.times { block_arg.call } # ブロックに収まったProcオブジェクトはcallで実行
end
foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}
メソッド定義において、仮引数はその種...