るりまサーチ

最速Rubyリファレンスマニュアル検索!
531件ヒット [1-100件を表示] (0.156秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:r[x] > クエリ:ruby[x] > クエリ:@[x] > クラス:Object[x]

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. fileutils cp_r

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Object#marshal_dump -> object (6156.0)

Marshal.#dump を制御するメソッドです。

...Marshal.#dump を制御するメソッドです。

Marshal.dump(some) において、出力するオブジェクト some がメソッド marshal_dump を
持つ場合には、その返り値がダンプされたものが Marshal.dump(some) の返り値となります。

marshal_dump/marshal_load...
... Ruby 1.8.0 から導入されました。
これから書くプログラムでは _dump/_load ではなく
marshal_dump/marshal_load を使うべきです。

@
return 任意のオブジェクトで marshal_load の引数に利用できます。

//emlist[][ruby]{
class Foo
def initialize(arg)...
...arg
end
def marshal_dump
@
foo
end
def marshal_load(obj)
p obj
@
foo = obj
end
end
foo = Foo.new(['foo', 'bar'])
p foo #=> #<Foo:0xbaf3b0 @foo=["foo", "bar"]>
dms = Marshal.dump(foo)
p dms #=> "\004\bU:\bFoo[\a\"\bfoo\"\bbar"
r
esult = Mar...

Object#respond_to?(name, include_all = false) -> bool (6144.0)

オブジェクトがメソッド name を持つとき真を返します。

...きることをいいます。

Windows での Process.fork や GNU/Linux での File.lchmod の
ような NotImplementedError が発生する場合は false を返します。

※ NotImplementedError が発生する場合に false を返すのは
Ruby
の組み込みライブラリや標準ライ...
...メソッドのみです。
Ruby
で実装されたメソッドで NotImplementedError が発生する場合は true を返します。

メソッドが定義されていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。

@
param name Symbol または文字...
...名です。

@
param include_all private メソッドと protected メソッドを確認の対象に
含めるかを true か false で指定します。省略した場合
は false(含めない) を指定した事になります。

//emlist[][ruby]{
class F...

Object#trust -> self (6140.0)

このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。 Object#untaint と同じ動作をします。

...このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。
Object
#untaint と同じ動作をします。


@
see Object#untrusted?,Object#untrust...

Object#untrust -> self (6140.0)

このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。 Object#taint と同じ動作をします。

...このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。
Object
#taint と同じ動作をします。


@
see Object#trust,Object#untrusted?...

Object#untrusted? -> bool (6140.0)

このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。 Object#tainted? と同じ動作をします。

...このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。
Object
#tainted? と同じ動作をします。


@
see Object#trust,Object#untrust...

絞り込み条件を変える

Object#untrusted? -> false (6140.0)

このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。 Object#tainted? と同じ動作をします。

...このメソッドは Ruby 2.1 から deprecated で、Ruby 3.2 で削除予定です。
Object
#tainted? と同じ動作をします。


@
see Object#trust,Object#untrust...

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

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

...

@
param name 削除するインスタンス変数の名前をシンボルか文字列で指定します。
@
raise NameError オブジェクトがインスタンス変数 name を持たない場合に発生します。

//emlist[][ruby]{
class Foo
def foo
@
foo = 1
p remove_instance_variabl...
...e(:@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...

Object#enum_for(method = :each, *args) -> Enumerator (6132.0)

Enumerator.new(self, method, *args) を返します。

...Enumerator.new(self, method, *args) を返します。

ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@
param method メソッド名の文字列かシンボルです。
@
param args 呼び出...
...][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def rep...
...eat(n)
r
aise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
r
eturn to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end...

Object#enum_for(method = :each, *args) {|*args| ... } -> Enumerator (6132.0)

Enumerator.new(self, method, *args) を返します。

...Enumerator.new(self, method, *args) を返します。

ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@
param method メソッド名の文字列かシンボルです。
@
param args 呼び出...
...][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def rep...
...eat(n)
r
aise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
r
eturn to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end...

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

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

...var が定義されていたら真を返します。

@
param var インスタンス変数名を文字列か Symbol で指定します。

//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_get,Object#instance_variable_set,Object#instance_variables...

絞り込み条件を変える

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

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

...var に値 value を設定します。

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

@
param var インスタンス変数名を文字列か Symbol で指定します。
@
param value 設定する値です。
@
return 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?...
<< 1 2 3 ... > >>