るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. matrix i
  5. ipaddr to_i

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

irb (26096.0)

irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

...irb は Interactive Ruby の略です。
i
rb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

=== irb の使い方

Ruby さえ知っていれば irb を使うのは簡単です。
i
rb コマンドを実行すると、以下のようなプロン...
...

$ irb
i
rb(main):001:0>

あとは Ruby の式を入力するだけで、その式が実行され、結果が表示されます。

i
rb(main):001:0> 1+2
3
i
rb(main):002:0> class Foo
i
rb(main):003:1> def foo
i
rb(main):004:2> print 1
i
rb(main):005:2> end
i
rb(main):006:1>...
...

i
rb(main):004:0> x = "OK" # ローカル変数 x を定義
=> "OK"
i
rb(main):005:0> x # x を表示
=> "OK"
i
rb(main):006:0> irb # サブ irb を起動
i
rb#1(main):001:0> x # x を表示
NameError: undefined local variable or me...

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

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

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

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

void rb_alias_variable(ID name1, ID name2) (18400.0)

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

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

...emlist[][ruby]{
class Fred
def initialize(p1, p2)
@a, @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_ge...
...t,Object#instance_variable_set,Object#instance_variables...

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

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

...//emlist[例][ruby]{
def foo
a = 1
binding.local_variable_defined?(:a) # => true
binding.local_variable_defined?(:b) # => false
end
//}

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

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

@see Binding#lo...
...cal_variable_get, Binding#local_variable_set...

絞り込み条件を変える

WIN32OLE_VARIABLE#variable_kind -> String (18213.0)

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

...類(VARKIND)を取得します。

この変数の種類を示す文字列を返します。

@return VARKINDに対応する文字列を返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
puts tobj.variables.map {|v| v.variable_kind}.uniq # => CO...
...以下のいずれかとなります。

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

@see WIN32OLE_VARIABLE#varkind...

Binding#local_variable_set(symbol, obj) (15249.0)

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

...//emlist[例][ruby]{
def foo
a = 1
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.lo...
...cal_variable_get(:b) # => 3
p a # => 2
p b # => NameError
end
//}

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

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

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

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

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

...ol オブジェクトで指定します。

@raise NameError 引数 symbol で指定したローカル変数が未定義の場合に発生します。

//emlist[例][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?...

Binding#local_variables -> [Symbol] (15200.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")
//}...

MonitorMixin::ConditionVariable#wait(timeout = nil) -> bool (15100.0)

モニタのロックを開放し、現在のスレッドを停止します。

...ックを保持している必要があります。

MonitorMixin::ConditionVariable#signal や
MonitorMixin::ConditionVariable#broadcast
で起こされるまでスレッドは停止し続けます。

timeout を与えた場合は最大 timeout 秒まで停止した後にスレッドを
再開し...
...によって危険領域(critical section)上で動作している
スレッドはただ一つになり、排他を実現します。

true を返します。timeout が与えられていて待ち時間が timeout を
越えた場合は false を返します。

@param timeout タイムアウトま...
...での秒数。指定しなかった場合はタイムアウトしません。

@raise ThreadError ロックを持っていないスレッドがこのメソッドを呼びだした場合に発生します

@see MonitorMixin::ConditionVariable#wait_while, MonitorMixin::ConditionVariable#wait_until...

絞り込み条件を変える

<< 1 2 3 ... > >>