キーワード
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 3
. 0 . 0 (4) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- Ruby用語集 (11)
-
ruby 1
. 8 . 3 feature (11) - オブジェクト指向スクリプト言語 Ruby リファレンスマニュアル (11)
- クラス/メソッドの定義 (11)
- 変数と定数 (11)
検索結果
-
変数と定数 (3025.0)
-
変数と定数 * local * instance * class * class_var_scope * global * pseudo * const * prio
...> nil
# 1
# nil <- これが nil であることに注意
# 1
//}
宣言は、たとえ実行されなくても宣言とみなされます。
//emlist[][ruby]{
v = 1 if false # 代入は行われないが宣言は有効
p defined?(v) # => "local-variable"
p v # => ni......「'$' + 10進数字」という名前を持つ変数を特殊変数と呼びます。
また、 $-F や $-I のような変数もあります。
これらは Ruby の起動オプションと -F や -I などと対応しており、オプション変数と呼ばれます。
==== スコープ
組......似変数へ代入すると文法エラーになります。
===[a:const] 定数
//emlist[例][ruby]{
FOOBAR
//}
アルファベット大文字 ([A-Z]) で始まる識別子は定数です。
定数の定義 (と初期化) は代入によって行われますが、メソッドの
中では定義......ると文法エラーになります。
===[a:const] 定数
//emlist[例][ruby]{
FOOBAR
FOOBAR
//}
アルファベット大文字 ([A-Z]) で始まる識別子は定数です。
他にも、ソースエンコーディングが Unicode の時は Unicode の大文字または
タイト... -
ruby 1
. 8 . 3 feature (1501.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
...されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど
* 互換性のある変更
* only backward-compatibility
* 影響の範囲が小さいと思われる変更もこちら
* [change]: 変更されたクラス/メソッドなど(互換......てください。
soap4r-1.5.3がruby-1.8.2、soap4r-1.5.5がruby-1.8.3にbundleされています。
* ((<URL:http://dev.ctor.org/soap4r/wiki/Changes-154>))
* ((<URL:http://dev.ctor.org/soap4r/wiki/Changes-155>))
== 1.8.2 (2004-12-25) -> 1.8.3 (2005-09-21)
=== 2005-09-19
: FileUtils.remove_ent......005-09-16
: File.join [ruby] [compat]
型チェックを厳密にするようになりました。
$ ruby-1.8.2 -e 'p File.join(1, 2)'
"1/2"
$ ruby-1.8.3 -e 'p File.join(1, 2)'
-e:1:in `join': can't convert Fixnum into String (TypeError)
from -e:1
=== 2005-09-16... -
NEWS for Ruby 3
. 0 . 0 (307.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...mlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}
* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]
* `=>` is added. It can be used like a rightward assignment.
17260
* `in......> 0
{b: 0, c: 1} => {b:}
p b #=> 0
//}
//emlist{
# version 3.0
0 in 1 #=> false
# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}
* Find-pattern is added. [EXPERIMENTAL]
16828
//emlist{
case ["a", 1, "b", "c", 2, "d", "e", "f", 3]
in [*pre, String => x, String => y, *post]
p pr......ozen when
`# frozen-string-literal: true` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@Magic+Comments] for more details.
17273
* A {static analysis}[rdoc-label:label-Static+analysis] founda... -
Ruby用語集 (157.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
...l#percent
: 0 オリジン
: zero-based
番号が 0 から始まること。
例えば、
Array や Vector、Matrix などの要素の番号、
String における文字の位置、
といったものは 0 オリジンである。
: 1 オリジン
: one-based
番号が 1 から始ま......し、切り替えて使うための
ツールの一つ。Linux、macOS などで動作する。
https://github.com/rbenv/rbenv
: RD(Ruby Document format)
Ruby スクリプト中に記述することを念頭に作られたドキュメントフォーマット。
: RDoc
Ruby スクリ......。そうでない場所では、メソッドを使って
間接的に参照・代入できる。
→アクセッサー
参照:d:spec/variables#instance
: インスタンスメソッド
: instance method
クラスやモジュールに定義されるメソッドは、定義方法によ... -
NEWS for Ruby 2
. 0 . 0 (115.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...は参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 1.9.3 以降の変更
=== 言語仕様の変更
* キーワード引数を追加しました......カルな変数を取得します
(these are different than Fiber local variables).
* 追加: Thread#thread_variable_set スレッドローカルな変数をセットします
* 追加: Thread#thread_variables スレッドローカルな変数の名前のリストを取得します......olv
* 追加: Resolv::DNS#timeouts=
* 追加: Resolv::DNS::Config#timeouts=
* rexml
* REXML::Document#write はハッシュ引数をサポートしました
* REXML::Document#write は :encoding オプションをサポートしました。
XMLドキュメントのエンコ... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (109.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
...xxx # => 実行結果
慣用的に実行結果を示すために使われるコメントの書き方。
: #! ruby -Ks
shebang。d:spec/rubycmd#shebangを参照。
: # coding: utf-8
マジックコメント。d:spec/m17n#magic_comment を参照。
: "a is #{a}"
d:spec/literal#exp
//emlist{......法の一種。d:spec/literal#percent。ダブルクォート文字列で %Q!STRING! と同じ。
//emlist{
p %!nomad! #=> "nomad"
//}
: % ruby -e "puts 'Hello'"
コマンドラインへの入力を示す。rubyスクリプト上で入力を行うには `command` や system(command) などと......現の 1 回以上の繰り返し
===[a:minus] -
: 3 - 2
引き算。または類似のメソッド
: 3 * (-5)
単項 - (マイナス)。混乱を避けるため適宜()でくくるとよい。
: % ruby -w など コマンドラインの入力 -AAA
コマンドラインオプション
==... -
クラス/メソッドの定義 (97.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...い場合は nil を返します。
===[a:method] メソッド定義
//emlist[例][ruby]{
def fact(n)
if n == 1 then
1
else
n * fact(n-1)
end
end
//}
文法:
def メソッド名 ['(' [arg0 ['=' default0]] ... [',' '*' rest_args [, post ...]] [',' key1: [val1]] ... [',' '*......を省いてdef foo a, bとも
a + 3 * b
end
//}
メソッド名としては通常の識別子の他に、再定義可能な演算子(例: ==, +, -
など spec/operator を参照)も指定できます(operator参照)。
//emlist[例][ruby]{
class Vector2D
attr_accessor :x, :y # インスタ......# rest: ["foo", "bar", "baz"]
# x: "x"
# y: "y"
# z: "z"
# k: 42
# kwrest: {:u=>"unknown"}
# blk: #<Proc:0x007f7e7d8dd6c0@-:16>
//}
//emlist[例: イテレータの定義][ruby]{
# yield を使う
def foo
# block_given? は、メソッドがブロックを渡されて... -
NEWS for Ruby 2
. 2 . 0 (67.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...は参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.1.0 以降の変更
=== 言語仕様の変更
* nil/true/false
* nil/true/false はフ......スできないという長年のバグを修正しました。 9593
=== 組み込みクラスの更新
* Binding
* 追加: Binding#local_variables
* 追加: Binding#receiver
* Dir
* 追加: Dir#fileno
* Enumerable
* 追加: Enumerable#slice_after
* 追加: Enumerable#s......た
* GC
* 非互換: GC.stat のエントリーの名前を変更しました 9924
https://docs.google.com/spreadsheets/d/11Ua4uBr6o0k-nORrZLEIIUkHJ9JRzRR0NyZfrhEEnc8/edit?usp=sharing
* Hash
* 非互換: 重複するキーの上書きに関するポリシーを変更しました... -
オブジェクト指向スクリプト言語 Ruby リファレンスマニュアル (39.0)
-
オブジェクト指向スクリプト言語 Ruby リファレンスマニュアル * Ruby オフィシャルサイト https://www.ruby-lang.org/ja/ * 原著:まつもとゆきひろ * 最新版URL: https://www.ruby-lang.org/ja/documentation/
...語 Ruby リファレンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほぼ揃っています......セスの実行:
* spec/eval
* spec/terminate
* spec/thread
* spec/safelevel
Ruby の文法:
* spec/lexical
* spec/program
* spec/variables
* spec/literal
* spec/operator
* spec/control
* spec/call
* spec/def
その他:
* spec/m17n
* spec/regexp
* spec/lambda_proc
==......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 2.3 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 2.4 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 2.5 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 2.6 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 2.7 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 3.0 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 3.1 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 3.2 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ......* spec/class
プロセスの実行:
* spec/eval
* spec/terminate
* spec/thread
Ruby の文法:
* spec/lexical
* spec/program
* spec/variables
* spec/literal
* spec/operator
* spec/control
* spec/call
* spec/def
その他:
* spec/m17n
* spec/regexp
* spec/lambda_proc
=......レンスマニュアル
* Ruby オフィシャルサイト https://www.ruby-lang.org/ja/
* version 3.3 対応リファレンス
* 原著:まつもとゆきひろ
* 最新版URL: https://www.ruby-lang.org/ja/documentation/
=== 使用上の注意
組込みクラスのリファレンスはほ...