るりまサーチ

最速Rubyリファレンスマニュアル検索!
245件ヒット [1-100件を表示] (0.112秒)

別のキーワード

  1. _builtin local_variables
  2. pp pretty_print_instance_variables
  3. win32ole variables
  4. kernel local_variables
  5. module class_variables

検索結果

<< 1 2 3 > >>

WIN32OLE_TYPE#variables -> [WIN32OLE_VARIABLE] (18108.0)

型が持つ変数を取得します。

...取得できない場合に通知します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
vars = tobj.variables
vars.each do |v|
puts "#{v.name} = #{v.value}"
end

上記を実行すると以下の出力が得られます。

xlChart = -4109...

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

Binding#local_variables -> [Symbol] (6114.0)

ローカル変数の一覧を Symbol の配列で返します。

...カル変数の一覧を Symbol の配列で返します。

//emlist[例][ruby]{
def foo
a = 1
2.times do |n|
binding.local_variables #=> [:a, :n]
end
end
//}

このメソッドは以下のコードと同様の動作をします。

//emlist[][ruby]{
binding.eval("local_variables")
//}...

NameError#local_variables -> [Symbol] (6108.0)

self が発生した時に定義されていたローカル変数名の一覧を返します。

...発生した時に定義されていたローカル変数名の一覧を返します。

内部での使用に限ります。

例:

def foo
begin
b = "bar"
c = 123
d
rescue NameError => err
p err.local_variables #=> [:b, :c, :err]
end
end

a = "buz"
foo...

絞り込み条件を変える

Object#pretty_print_instance_variables -> [String | Symbol] (6102.0)

プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。 返されたインスタンス変数はプリティプリント時に表示されます。

プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。
返されたインスタンス変数はプリティプリント時に表示されます。

pp に表示したくないインスタンス変数がある場合にこのメソッドを再定義します。

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

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

...ます。false を指定した場合 対象にはなりません。

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

//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の...

Object#initialize_copy(obj) -> object (25.0)

(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。

...ck(obj)
puts "instance variables: #{obj.inspect}"
puts "tainted?: #{obj.tainted?}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end

obj.foo = 1
obj.taint

check Object.new.send(:initialize_copy, obj)
#=> instance variables: #<Object:0x4019c9d4>...
...n methods: #<NoMethodError: ...>
check obj.dup
#=> instance variables: #<Object:0x4019c9c0 @foo=1>
# tainted?: true
# singleton methods: #<NoMethodError: ...>
check obj.clone
#=> instance variables: #<Object:0x4019c880 @foo=1>
# tainted?: true
#...
...:bar
end
end

def check(obj)
puts "instance variables: #{obj.inspect}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end

obj.foo = 1

check Object.new.send(:initialize_copy, obj)
#=> instance variables: #<Object:0x4019c9d4>
# singleton m...
...ethods: #<NoMethodError: ...>
check obj.dup
#=> instance variables: #<Object:0x4019c9c0 @foo=1>
# singleton methods: #<NoMethodError: ...>
check obj.clone
#=> instance variables: #<Object:0x4019c880 @foo=1>
# singleton methods: :bar
//}...

WIN32OLE_VARIABLE#name -> String (19.0)

変数名を取得します。

...変数名を取得します。

@return 変数名を文字列で返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
variables
= tobj.variables
variables
.each do |variable|
puts "#{variable.name}" # => xlChart, xlDialogSheet, ...
end...

WIN32OLE_VARIABLE#ole_type -> String (19.0)

変数の型を取得します。

...の形式の文字列
を返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
variables
= tobj.variables
variables
.each do |variable|
puts "#{variable.ole_type} #{variable.name}"
end

OLEオートメーションの型名は、対応す...

絞り込み条件を変える

<< 1 2 3 > >>