るりまサーチ

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

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

検索結果

<< 1 2 > >>

WIN32OLE_TYPE#variables -> [WIN32OLE_VARIABLE] (18114.0)

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

...aise WIN32OLERuntimeError 型属性が取得できない場合に通知します。

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

上記を実行すると以下の出力が得...

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

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

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

...ject.new
class <<obj
attr_accessor :foo
def bar
:bar
end
end

def check(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.sen...
...d(:initialize_copy, obj)
#=> instance variables: #<Object:0x4019c9d4>
# tainted?: false
# singleton methods: #<NoMethodError: ...>
check obj.dup
#=> instance variables: #<Object:0x4019c9c0 @foo=1>
# tainted?: true
# singleton methods: #<NoMetho...
...dError: ...>
check obj.clone
#=> instance variables: #<Object:0x4019c880 @foo=1>
# tainted?: true
# singleton methods: :bar
//}

@see Object#initialize_clone, Object#initialize_dup...
...list[][ruby]{
obj = Object.new
class <<obj
attr_accessor :foo
def bar
: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...
...# singleton methods: #<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
//}

@see Obje...

WIN32OLE_VARIABLE#name -> String (25.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 (25.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オートメーショ...

絞り込み条件を変える

WIN32OLE_VARIABLE#to_s -> String (25.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#value -> object | nil (25.0)

変数の値を取得します。

...数が持つ定数値。値を持たない場合はnilを返します。


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

実行結果は以下と...

Object#instance_variable_defined?(var) -> bool (13.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 (13.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?...
<< 1 2 > >>