種類
- インスタンスメソッド (33)
- 文書 (26)
- モジュール関数 (22)
- 定数 (11)
- 特異メソッド (11)
ライブラリ
- ビルトイン (77)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
INTERNAL
_ CONSTANTS (11) -
NEWS for Ruby 3
. 0 . 0 (4) -
class
_ variables (11) -
global
_ variables (11) -
instance
_ variables (11) -
local
_ variables (11) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
Module
# constants(inherit = true) -> [Symbol] (18262.0) -
そのモジュール(またはクラス)で定義されている定数名の配列を返します。
...ます。
Object のサブクラスの場合、Objectやそのスーパークラスで定義されている
定数は含まれません。 Object.constants とすると Object クラスで定義された
定数の配列が得られます。
得られる定数の順序は保証されません。
@p......dule.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#class_variables
//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得して後で差し引く
$clist = Module.constants
cla......s Bar
BAR = 1
# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO は含まれない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []
# ネス... -
Module
. constants -> [Symbol] (18214.0) -
このメソッドを呼び出した時点で参照可能な定数名の配列を返します。
...配列を返します。
//emlist[例][ruby]{
class C
FOO = 1
end
p Module.constants # => [:RUBY_PLATFORM, :STDIN, ..., :C, ...]
# 出力中に :FOO は現われない
//}
@see Module#constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables,... -
GC
:: INTERNAL _ CONSTANTS -> {Symbol => Integer} (6208.0) -
GC用内部定数の値を保持するハッシュテーブルです。
...GC用内部定数の値を保持するハッシュテーブルです。
GC::INTERNAL_CONSTANTS
# => {:RVALUE_SIZE=>40, :HEAP_PAGE_OBJ_LIMIT=>408, :HEAP_PAGE_BITMAP_SIZE=>56, :HEAP_PAGE_BITMAP_PLANES=>4}... -
Kernel
. # global _ variables -> [Symbol] (113.0) -
プログラム中で定義されているグローバル変数(`$'で始まる変数)名の 配列を返します。
...グラム中で定義されているグローバル変数(`$'で始まる変数)名の
配列を返します。
//emlist[例][ruby]{
p global_variables #=> [:$;, :$-F, :$@, ... ]
//}
@see Kernel.#local_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables... -
Kernel
. # local _ variables -> [Symbol] (113.0) -
現在のスコープで定義されているローカル変数名の配列を返します。
...現在のスコープで定義されているローカル変数名の配列を返します。
//emlist[例][ruby]{
yuyu = 0
p local_variables #=> [:yuyu]
//}
@see Kernel.#global_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables... -
Module
# class _ variables(inherit = true) -> [Symbol] (113.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...d
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variables # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}
@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#constants... -
Object
# instance _ variables -> [Symbol] (113.0) -
オブジェクトのインスタンス変数名をシンボルの配列として返します。
...列として返します。
//emlist[][ruby]{
obj = Object.new
obj.instance_eval { @foo, @bar = nil }
p obj.instance_variables
#=> [:@foo, :@bar]
//}
@see Object#instance_variable_get, Kernel.#local_variables, Kernel.#global_variables, Module.constants, Module#constants, Module#class_variables... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (66.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への変更点(まとめ)/サポートプラットフォームの追加>))
...より、(({$?})) の値も整数からこのクラ
スのインスタンスになりました。
=== クラス階層
: ((<File::Constants>))
File::Constants は、File クラスでなく IO クラスが include するように
なりました。((<ruby-dev:20964>))
: ((<UnboundMethod>)) [......le.fnmatch?>)) [new]
追加
このメソッドで使用するフラグ FNM_NOESCAPE, FNM_PATHNAME, FNM_PERIOD,
FNM_CASEFOLD も((<File::Constants>)) モジュールに定義されました。
: ((<File/File.lchmod>)) [new]
: ((<File/File.lchown>)) [new]
追加
=== File::Stat
:......追加
(({str[n, 0] = other})) と同じ(ただし self を返す)
=== Struct
: ((<Struct/each_pair>)) [new]
追加。
=== Symbol
: ((<Symbol/Symbol.all_symbols>)) [new]
追加 ((<ruby-dev:12921>))
=== SystemCallError
: ((<SystemCallError/SystemCallError.===>)) [new]
追加... -
クラス/メソッドの定義 (48.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...File::Constants を include することで、
# File::RDONLY などと書かずに直接 RDONLY と書くことができる。
class File
module Constants
RDONLY = 0
WRONLY = 1
end
include Constants
end
File.open("foo", File::RDONLY)
# あるいは
include File::Constants
File.ope......e, else, ensure 節を指定できます。
例外処理についてはd:spec/control#begin参照。
メソッド定義式は、メソッド名を Symbol にしたオブジェクトを返します。
@see https://magazine.rubyist.net/articles/0041/0041-200Special-kwarg.html
====[a:operator] 演......指向システムにお
けるクラスメソッドの働きをすることになります。
特異メソッド定義式は、メソッド名を Symbol にしたオブジェクトを返します。
===[a:class_method] クラスメソッドの定義
Ruby におけるクラスメソッドとは... -
NEWS for Ruby 3
. 0 . 0 (42.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...iterals are no longer frozen 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......Module#attr_reader, Module#attr_writer and Module#attr methods now return an array of defined method names as symbols. 17314
* Module#alias_method now returns the defined alias as a symbol. 17314
//emlist[][ruby]{
class C; end
module M1; end
module M2; end
C.include M1
M1.include M2
p C.ancesto......* String#swapcase
* String#tr
* String#tr_s
* String#upcase
* Symbol
* Symbol#to_proc now returns a lambda Proc. 16260
* Symbol#name has been added, which returns the name of the symbol if it is named. The returned string is frozen. 16150
* Fiber
* Introduce F...