るりまサーチ

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. comparable >
  4. module >
  5. integer >

検索結果

WIN32OLE_VARIABLE#value -> object | nil (18338.0)

変数の値を取得します。

...ます。valueメソッ
ドはこのような定数値を返します。

@return この変数が持つ定数値。値を持たない場合は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

実行結果は以下となります。

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

WIN32OLE_TYPE#variables -> [WIN32OLE_VARIABLE] (18219.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...

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

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

...ンス変数 var に値 value を設定します。

インスタンス変数が定義されていなければ新たに定義されます。

@param var インスタンス変数名を文字列か Symbol で指定します。
@param value 設定する値です。
@return value を返します。

//e...
...mlist[][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?...

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

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

...erclass ]
式..
end

文法:

class 識別子 [`<' superclass ]
式..
[rescue [error_type,..] [=> evar] [then]
式..]..
[else
式..]
[ensure
式..]
end

クラスを定義します...
...//emlist[例][ruby]{
obj = Object.new # obj = nil でも可
class << obj
def test
# ...
end
# ...
end
//}

文法:

class `<<' expr
式..
end

文法:

class `<<' expr
式..
[rescue [error_type,..] [=> evar] [then]...
...# -obj

# 要素代入
def foo=(value); end # obj.foo = value

# [] と []=
def [](key); end # obj[key]
def []=(key, value); end # obj[key] = value
def []=(key, key2, value); end # obj[key, key2] = value

# バッククォート記法
def `(arg); e...

NEWS for Ruby 3.0.0 (60.0)

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

...o keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//...
...st #=> [2, "d", "e", "f", 3]
end
//}

* Endless method definition is added. [EXPERIMENTAL]
16746

//emlist{
def square(x) = x * x
//}

* Interpolated String literals are no longer frozen when
`# frozen-string-literal: true` is used. 17104
* Magic comment `shareable_constant_value` add...
...2.7.2).
Turn them on with `-W:deprecated` (or with `-w` to show other warnings too).
16345
* `$SAFE` and `$KCODE` are now normal global variables with no special behavior.
C-API methods related to `$SAFE` have been removed.
16131 17136
* yield in singleton class definitions in me...

絞り込み条件を変える

ruby 1.8.3 feature (54.0)

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

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

ruby 1.8.2 から ruby 1.8.3 までの変更点です。

掲載方針

*バグ修正の影響も含めて動作が変わるものを収録する。
*単にバグを直しただけのものは収録しない。
*ライブラリ...
...y-talk:146776>)) ((<ruby-talk:146894>))
$ cat test_dlg.rb
foo = Object.new
foo2 = SimpleDelegator.new(foo)
def foo.bar
puts "bar"
end
foo2.bar

$ ruby-1.8.2 -r delegate test_dlg.rb
test_dlg.rb:6: undefined method `bar' for #<Object:0x4021b0a0> (NoMethodEr...
...rror を投げます。

$ ruby-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 glob...