26件ヒット
[1-26件を表示]
(0.068秒)
キーワード
-
NEWS for Ruby 3
. 0 . 0 (4) - Ruby用語集 (11)
- 変数と定数 (11)
検索結果
-
NEWS for Ruby 3
. 0 . 0 (301.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用語集 (139.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 スクリ......ァイル自体のエンコーディング。
→エンコーディング
: スクリプト探索パス
=ロードパス
: スコープ
: scope
変数・定数・メソッドなどが参照(・代入)可能な、コード上の範囲。
Ruby の定数やグローバル変数はプ... -
変数と定数 (47.0)
-
変数と定数 * local * instance * class * class_var_scope * global * pseudo * const * prio
...変数と定数
* local
* instance
* class
* class_var_scope
* global
* pseudo
* const
* prio
Ruby の変数と定数の種別は変数名の最初の一文字によって、
ローカル変数、
インスタンス変数、
クラス変数、
グローバル変数、
定数
のい......> nil
# 1
# nil <- これが nil であることに注意
# 1
//}
宣言は、たとえ実行されなくても宣言とみなされます。
//emlist[][ruby]{
v = 1 if false # 代入は行われないが宣言は有効
p defined?(v) # => "local-variable"
p v # => ni......[][ruby]{
class Foo
end
class Bar < Foo
@@v = :bar
end
class Foo
@@v = :foo
end
class Bar
p @@v #=> :foo
end
//}
====[a:class_var_scope] クラス変数のスコープ
クラス変数は、その場所を囲むもっとも内側の(特異クラスでない) class 式
または mod......nd
class Foo
@@v = :foo
end
class Bar
p @@v #=> RuntimeError (class variable @@v of Bar is overtaken by Foo)
end
//}
====[a:class_var_scope] クラス変数のスコープ
クラス変数は、その場所を囲むもっとも内側の(特異クラスでない) class 式
または mod...