るりまサーチ

最速Rubyリファレンスマニュアル検索!
141件ヒット [1-100件を表示] (0.042秒)
トップページ > クエリ:Module.constants[x]

別のキーワード

  1. module attr
  2. module constants
  3. module class_eval
  4. module new
  5. module module_eval

検索結果

<< 1 2 > >>

Module.constants -> [Symbol] (62137.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, Module#class_variables...

Module#constants(inherit = true) -> [Symbol] (39245.0)

そのモジュール(またはクラス)で定義されている定数名の配列を返します。

...ます。
Object のサブクラスの場合、Objectやそのスーパークラスで定義されている
定数は含まれません。 Object.constants とすると Object クラスで定義された
定数の配列が得られます。

得られる定数の順序は保証されません。

@p...
...e Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#class_variables

//emlist[Module.constants Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得して後で差し引く
$clist = Module.constants...
...s Bar
BAR = 1

# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO は含まれない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []

# ネス...

Module#class_variables(inherit = true) -> [Symbol] (21030.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...

1.6.8から1.8.0への変更点(まとめ) (444.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への変更点(まとめ)/サポートプラットフォームの追加>))

...いう振
るまい(C の do ... while 構文と同じ)をしていませんでした。
((<ruby-list:34618>))

: ((<"rescue/ensure on class/module"|クラス/メソッドの定義/クラス定義>)) [compat]

メソッド定義のほかにもクラス定義やモジュール定義にもresc...
...クラスと発生した例外オブジェクトの比較 [ruby] [change]

発生した例外 $! と rescue 節の例外クラスとは ((<Module#===|Module/===>))
を使って比較するようになりました。

以前は kind_of? による比較なので基本的な動作に変わりは...
...えるかもしれません)
((<ruby-dev:19589>))

: while, until, class, module, def の値 [ruby] [change]

while, until, class, module, def が式として値を返すようになりました。

class/module は最後に評価した式の結果を返します。def は nil を返...

ruby 1.6 feature (168.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...01) [i586-linux]
""

=> ruby 1.6.7 (2002-03-29) [i586-linux]
"ruby-1.6\000-v\000-"

: 2002-03-22 ((<Module/module_eval>))

((<Module/module_eval>)) のブロック内で定数やクラス変数のスコープが
変わることはなくなりました。((<ruby-dev:...
...l)

: rb_define_module_under()

C 関数 rb_define_module_under() でモジュールを定義するときに同名の定
数が既に定義されていると失敗していました。((<ruby-talk:30203>))

Constants
= 1
require 'syslog'
p Syslog::Constants

=> -:...
...いました。((<ruby-dev:14942>))

Module.constants
.each {|c|
c = eval c
if c.instance_of?(Class)
p c
c.instance_methods.each {|m|
c.module_eval "undef #{m};"
}
c.module_eval {undef initialize}
end...

絞り込み条件を変える

クラス/メソッドの定義 (142.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...クラス/メソッドの定義
* クラス/メソッドの定義:
* class
* singleton_class
* module
* method
* operator
* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* d...
...を include できるなどのため)
module
Net
class HTTP
end
class FTP
end
end

obj = Net::HTTP.new

# あるいは

include Net
obj = HTTP.new

# 以下のような使い方は組み込みのクラスにも見られる
# 利用者は File::Constants を include することで、
# File...
...どと書かずに直接 RDONLY と書くことができる。
class File
module
Constants
RDONLY = 0
WRONLY = 1
end
include Constants
end

File.open("foo", File::RDONLY)

# あるいは

include File::Constants
File.open("foo", RDONLY)

# 上記はあくまでも例である。実際...

NEWS for Ruby 3.0.0 (108.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...
...is now a SyntaxError instead of a LocalJumpError. 15575
* When a class variable is overtaken by the same definition in an
ancestor class/module, a RuntimeError is now raised (previously,
it only issued a warning in verbose mode). Additionally, accessing a
class variable from the t...
...* Module
* Module#include and Module#prepend now affect classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes included or prepended the receiver. 9573
* Module#pu...

NEWS for Ruby 2.0.0 (60.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...#transfer を呼び出したファイバーを再開できなくなりました

* File
* 拡張: File.fnmatch? は File::FNM_EXTGLOB(File::Constants::FNM_EXTGLOB) オプションが与えられていればブレースを展開します

* GC
* 改良:
* ビットマップ...
...* Module
* 追加: Module#prepend 指定したモジュールを self の継承チェインの先頭に
「追加する」ことで self の定数、メソッド、モジュール変数を「上書き」します。
* 追加: Module.prepended, Module.prepend_features は Module.inc...
...luded と Module.append_features に似ています
* 追加(実験的): Module#refine, スコープを限定してクラスやモジュールを拡張します。
* 拡張: Module#define_method は UnboundMethod を受け付けるようになりました
* 拡張: Module#const_get 修...

NEWS for Ruby 2.5.0 (60.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...た 11286

* File
* File.open :newline オプションを指定するとテキストモードになります 13350
* File#path はFile::Constants::TMPFILE付きで開いたファイルに対して IOError を発生させます
13568
* File.stat, File.exist? など rb_stat() を...
...thod#callを呼び出します 14142

* Module
* Module#attr, Module#attr_accessor, Module#attr_reader, Module#attr_writer はパブリックメソッドになりました 14132
* Module#define_method, Module#alias_method, Module#undef_method, Module#remove_method はパブリックメソ...

Kernel.#global_variables -> [Symbol] (36.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] (36.0)

現在のスコープで定義されているローカル変数名の配列を返します。

...現在のスコープで定義されているローカル変数名の配列を返します。

//emlist[例][ruby]{
yuyu = 0
p local_variables #=> [:yuyu]
//}

@see Kernel.#global_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables...
<< 1 2 > >>