るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 > >>

Object#to_enum(method = :each, *args) -> Enumerator (142.0)

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

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

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


@param method メソッド名の文字列かシンボルです。
@param args 呼び出...
...

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

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

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

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

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


@param method メソッド名の文字列かシンボルです。
@param args 呼び出...
...

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

Object#class -> Class (132.0)

レシーバのクラスを返します。

...レシーバのクラスを返します。

//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}

@see Class#superclass,Object#kind_of?,Object#instance_of?...

Object#display(out = $stdout) -> nil (132.0)

オブジェクトを out に出力します。

...mlist[][ruby]{
class Object
def display(out = $stdout)
out.write self
nil
end
end
//}

@param out 出力先のIOオブジェクトです。指定しない場合は標準出力に出力されます。
@return nil を返します。

//emlist[][ruby]{
Object
.new.display #=> #<Object:0xbb02...

Object#<=>(other) -> 0 | nil (130.0)

self === other である場合に 0 を返します。そうでない場合には nil を返します。

...
self
=== other である場合に 0 を返します。そうでない場合には nil を返します。

//emlist[例][ruby]{
a = Object.new
b = Object.new
a <=> a # => 0
a <=> b # => nil
//}

@see Object#===...

絞り込み条件を変える

Object#equal?(other) -> bool (130.0)

other が self 自身の時、真を返します。

...other が self 自身の時、真を返します。

二つのオブジェクトが同一のものかどうか調べる時に使用します。
このメソッドを再定義してはいけません。

お互いのObject#object_idが一致する
かどうかを調べます。

@param other 比較...
...するオブジェクトです。

//emlist[][ruby]{
p("foo".equal?("bar")) #=> false
p("foo".equal?("foo")) #=> false

p(4.equal?(4)) #=> true
p(4.equal?(4.0)) #=> false

p(:foo.equal? :foo) #=> true
//}

@see Object#object_id,Object#==,Object#eql?,Symbol...

Object#_dump(limit) -> String (126.0)

Marshal.#dump において出力するオブジェクトがメソッド _dump を定義している場合には、そのメソッドの結果が書き出されます。

...ッド _dump
を定義している場合には、そのメソッドの結果が書き出されます。

バージョン1.8.0以降ではObject#marshal_dump, Object#marshal_loadの使用
が推奨されます。 Marshal.dump するオブジェクトが _dump と marshal_dump の両方の
メソッ...
...クトを文字列化したものを返すように定義すべきです。

//emlist[][ruby]{
class Foo
def initialize(arg)
@foo = arg
end
def _dump(limit)
Marshal.dump(@foo, limit)
end
def self._load(obj)
p obj
Foo.new(Marshal.load(obj))
end
end
foo = Foo.new(['foo', 'b...
...rshal.dump(foo)
p dms #=> "\004\bu:\bFoo\023\004\b[\a\"\bfoo\"\bbar"
result = Marshal.load(dms) #=> "\004\b[\a\"\bfoo\"\bbar" # self._load の引数
p result #=> #<Foo:0xbaf07c @foo=["foo", "bar"]>
//}

インスタンス変数の情報は普通マーシャル...

Object#!~(other) -> bool (120.0)

自身が other とマッチしない事を判定します。

...自身が other とマッチしない事を判定します。

self
#=~(obj) を反転した結果と同じ結果を返します。

@param other 判定するオブジェクトを指定します。

//emlist[例][ruby]{
obj = 'regexp'
p (obj !~ /re/) # => false

obj = nil
p (obj !~ /re/) # => true
/...

Object#marshal_load(obj) -> object (120.0)

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

...返り値が marshal_load の引数に利用されます。
marshal_load 時の self は、生成されたばかり(Class#allocate されたばかり) の状態です。

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

@param obj marshal_dump の返り値のコピーです。

@return 返り値は無視されます。


@see Object#marshal_dump, Marshal...
<< < 1 2 3 4 > >>