るりまサーチ

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

別のキーワード

  1. kernel global_variables
  2. _builtin global_variables
  3. fiddle rtld_global
  4. handle rtld_global
  5. socket ipv6_mc_global?

ライブラリ

クラス

モジュール

検索結果

Kernel.#global_variables -> [Symbol] (18113.0)

プログラム中で定義されているグローバル変数(`$'で始まる変数)名の 配列を返します。

...グラム中で定義されているグローバル変数(`$'で始まる変数)名の
配列を返します。

//emlist[例][ruby]{
p global_variables #=> [:$;, :$-F, :$@, ... ]
//}

@
see Kernel.#local_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables...

Object#instance_variables -> [Symbol] (24.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...

ruby 1.8.3 feature (24.0)

ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))

...y-talk:144741>))

class Fred
@
@foo = 99
def foo
@
@foo
end
end

def Fred.foo
@
@foo = 101 #=> @@foo は Fred クラスのクラス変数ではない。
end

def Fred.foo_foo
class_variable_set(:@@foo, 101) # self が Fred ク...
...ラス自身であることに注意。クラス変数 @@foo に値をセットする。
end

Fred.foo # メソッドを呼んでも、Fred クラスのクラス変数 @@foo は変わらない。
p Fred.new.foo #=> 99

Fred.foo_foo #
p Fred.new.foo #...
...y-1.8.2 -se 'puts global_variables.grep(/foo/)' -- --foo-bar
$-foo-bar
$ ruby-1.8.3 -se 'puts global_variables.grep(/foo/)' -- --foo-bar
$_foo_bar

$ ruby-1.8.3 -se 'puts global_variables.grep(/foo/)' -- --foo\@bar
-e: invalid name for global variable - --foo@bar (NameError)...

Module#class_variables(inherit = true) -> [Symbol] (18.0)

クラス/モジュールに定義されているクラス変数の名前の配列を返します。

...す。

@
param inherit false を指定しない場合はスーパークラスやインクルードして
いるモジュールのクラス変数を含みます。

//emlist[例][ruby]{
class One
@
@var1 = 1
end
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...

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

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

...ん。

@
param inherit true を指定するとスーパークラスや include したモジュールで
定義された定数が対象にはなります。false を指定した場合 対象にはなりません。

@
see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Obje...

絞り込み条件を変える

Kernel.#local_variables -> [Symbol] (12.0)

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

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

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

@
see Kernel.#global_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables...

Module.constants -> [Symbol] (12.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...