るりまサーチ

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

別のキーワード

  1. win32ole win32ole_variable
  2. win32ole_variable to_s
  3. win32ole variable_kind
  4. win32ole_variable name
  5. win32ole_variable value

検索結果

<< 1 2 3 ... > >>

WIN32OLE_VARIABLE#variable_kind -> String (9114.0)

変数の種類(VARKIND)を取得します。

...対応する文字列を返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
puts tobj.variables.map {|v| v.variable_kind}.uniq # => CONSTANT

返送値は以下のいずれかとなります。

: PERINSTANCE
インスタンス毎の変数。構造...
...体やユーザ定義体のフィールド。(0)
: STATIC
クラスの静的変数。(1)
: CONSTANT
定数。enumやモジュールのメンバ。(2)
: DISPATCH
変数アクセスにオートメーションを利用。旧型式のプロパティ。(3)

@see WIN32OLE_VARIABLE#varkind...

WIN32OLE_TYPE#variables -> [WIN32OLE_VARIABLE] (6220.0)

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

...がEnum(列挙型)やユーザ定義型の場合、メンバ変数の情報を
WIN32OLE_VARIABLEオブジェクトの配列として返します。

@return 型が持つ変数情報をWIN32OLE_VARIABLEの配列として返します。
変数を持たない場合は空配列を返しま...
...= tobj.variables
vars.each do |v|
puts "#{v.name} = #{v.value}"
end

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

xlChart = -4109
xlDialogSheet = -4116
xlExcel4IntlMacroSheet = 4
xlExcel4MacroSheet = 3
xlWorksheet = -4167

@see WIN32OLE_VARIABLE...

Binding#local_variable_set(symbol, obj) (6150.0)

引数 symbol で指定した名前のローカル変数に引数 obj を設定します。

...bind = binding
bind.local_variable_set(:a, 2) # set existing local variable `a'
bind.local_variable_set(:b, 3) # create new local variable `b'
# `b' exists only in binding
p bind.local_variable_get(:a) # => 2
p bind.local_variable_get(:b) # => 3
p a...
...# => NameError
end
//}

このメソッドは以下のコード(ただし、obj が Ruby のコードで出力される場
合)と同様の動作をします。

//emlist[][ruby]{
binding.eval("#{symbol} = #{obj}")
//}

@see Binding#local_variable_get, Binding#local_variable_defined?...

Binding#local_variable_defined?(symbol) -> bool (6132.0)

引数 symbol で指定した名前のローカル変数が定義されている場合に true を、 そうでない場合に false を返します。

...g.local_variable_defined?(:a) # => true
binding.local_variable_defined?(:b) # => false
end
//}

このメソッドは以下のコードの短縮形です。

//emlist[][ruby]{
binding.eval("defined?(#{symbol}) == 'local-variable'")
//}

@see Binding#local_variable_get, Binding#local_variable_set...

Object#instance_variable_defined?(var) -> bool (6132.0)

インスタンス変数 var が定義されていたら真を返します。

..., @b = p1, p2
end
end
fred = Fred.new('cat', 99)
p fred.instance_variable_defined?(:@a) #=> true
p fred.instance_variable_defined?("@b") #=> true
p fred.instance_variable_defined?("@c") #=> false
//}

@see Object#instance_variable_get,Object#instance_variable_set,Object#instance_variables...

絞り込み条件を変える

Object#instance_variable_get(var) -> object | nil (6132.0)

オブジェクトのインスタンス変数の値を取得して返します。

...Foo
def initialize
@foo = 1
end
end

obj = Foo.new
p obj.instance_variable_get("@foo") #=> 1
p obj.instance_variable_get(:@foo) #=> 1
p obj.instance_variable_get(:@bar) #=> nil
//}

@see Object#instance_variable_set,Object#instance_variables,Object#instance_variable_defined?...

Object#instance_variable_set(var, value) -> object (6132.0)

オブジェクトのインスタンス変数 var に値 value を設定します。

...value を返します。

//emlist[][ruby]{
obj = Object.new
p obj.instance_variable_set("@foo", 1) #=> 1
p obj.instance_variable_set(:@foo, 2) #=> 2
p obj.instance_variable_get(:@foo) #=> 2
//}

@see Object#instance_variable_get,Object#instance_variables,Object#instance_variable_defined?...

Binding#local_variable_get(symbol) -> object (6126.0)

引数 symbol で指定した名前のローカル変数に設定された値を返します。

...][ruby]{
def foo
a = 1
binding.local_variable_get(:a) # => 1
binding.local_variable_get(:b) # => NameError
end
//}

このメソッドは以下のコードの短縮形です。

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

@see Binding#local_variable_set, Binding#local_variable_defined?...

Module#class_variable_defined?(name) -> bool (6126.0)

name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。

...name Symbol か String を指定します。

//emlist[例][ruby]{
class Fred
@@foo = 99
end
Fred.class_variable_defined?(:@@foo) #=> true
Fred.class_variable_defined?(:@@bar) #=> false
Fred.class_variable_defined?('@@foo') #=> true
Fred.class_variable_defined?('@@bar') #=> false
//}...

Object#remove_instance_variable(name) -> object (6126.0)

オブジェクトからインスタンス変数 name を取り除き、そのインス タンス変数に設定されていた値を返します。

...ない場合に発生します。

//emlist[][ruby]{
class Foo
def foo
@foo = 1
p remove_instance_variable(:@foo) #=> 1
p remove_instance_variable(:@foo) # instance variable @foo not defined (NameError)
end
end
Foo.new.foo
//}

@see Module#remove_class_variable,Module#remove_const...

絞り込み条件を変える

<< 1 2 3 ... > >>