るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

BasicObject#==(other) -> bool (24112.0)

オブジェクトが other と等しければ真を、さもなくば偽を返します。

...ォルトでは Object#equal? と同じオブジェクトの同一性になっています。

@param other 比較対象となるオブジェクト
@return other が self と同値であれば真、さもなくば偽

//emlist[例][ruby]{
class Person < BasicObject
def initialize(name, age)
@n...
...ame = name
@age = age
end
end

tanaka1 = Person.new("tanaka", 24)
tanaka2 = Person.new("tanaka", 24)

tanaka1 == tanaka1 #=> true
tanaka1 == tanaka2 #=> false
//}

@see BasicObject#equal?, Object#==, Object#equal?,
Object#eql?...

Rinda::DRbObjectTemplate#===(ro) (18200.0)

@todo

...@todo

This DRbObjectTemplate matches +ro+ if the remote object's drburi
and drbref are the same. +nil+ is used as a wildcard....

Object#===(other) -> bool (15206.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

...Object#== を呼び出します。

when 節の式をレシーバーとして === を呼び出すことに注意してください。

また Enumerable#grep でも使用されます。

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

//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12...
...aby"
when 3 .. 6
"little child"
when 7 .. 12
"child"
when 13 .. 18
"youth"
else
"adult"
end

puts result #=> "child"

def check arg
case arg
when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of String class. But don't hit."
else
"unknown"...
...end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <Ruby's world>
//}

@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep...

Enumerable#find_index {|obj| ... } -> Integer | nil (12466.0)

条件に一致する最初の要素の位置を返します。

...トを指定します。

指定された val と == で等しい最初の要素の位置を返します。
等しい要素がひとつもなかった場合は nil を返します。

//emlist[例][ruby]{
(1..10).find_index(11) #=> nil
(1..10).find_index(2) #=> 1
//}

ブロックが与えられ...
...の位置を返します。
一つも真にならなかった場合は nil を返します。

//emlist[例][ruby]{
(1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
(1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
//}

引数、ブロックのどちらも与えられなか...

Pathname#join(*args) -> Pathname (12206.0)

与えられたパス名を連結します。

...list[例][ruby]{
require "pathname"

path0 = Pathname("/usr") # Pathname:/usr
path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
# 上記の path0 の処理は下記の path1 と同様のパスになります
path1 = Pathname("/usr") + "bin/ruby" # Pathname:/usr/bi...
...n/ruby
path0 == path1 #=> true
//}...

絞り込み条件を変える

Object#itself -> object (9206.0)

self を返します。

...self を返します。

//emlist[][ruby]{
string = 'my string' # => "my string"
string.itself.object_id == string.object_id # => true
//}...

Range#include?(obj) -> bool (9200.0)

obj が範囲内に含まれている時に true を返します。 そうでない場合は、false を返します。

...obj が範囲内に含まれている時に true を返します。
そうでない場合は、false を返します。

Range#=== は主に case 式での比較に用いられます。

<=> メソッドによる演算により範囲内かどうかを判定するには Range#cover? を使用して...
...します。

@param obj 比較対象のオブジェクトを指定します。

//emlist[例][ruby]{
p ("a" .. "c").include?("b") # => true
p ("a" .. "c").include?("B") # => false
p ("a" .. "c").include?("ba") # => false
p ("a" .. "c").cover?("ba") # => true

p (1 .. 3).include?(1.5) # => true...

BasicObject#__id__ -> Integer (9130.0)

各オブジェクトに対して一意な整数を返します。あるオブジェクトに対し てどのような整数が割り当てられるかは不定です。

...Object#object_id と同じですが、#object_id は BasicObject に
はない事に注意してください。

//emlist[例][ruby]{
# frozen_string_literal: false
obj = Object.new
obj.object_id == obj.__id__ # => true
Object.new.__id__ == Object.new.__id__ # => false
(21 * 2).__id_...
..._ == (21 * 2).__id__ # => true
"hello".__id__ == "hello".__id__ # => false
"hi".freeze.__id__ == "hi".freeze.__id__ # => true
//}

@see Object#object_id, 42840...

ObjectSpace.#memsize_of_all(klass = nil) -> Integer (9106.0)

すべての生存しているオブジェクトが消費しているメモリ使用量をバイト単位 で返します。

...ドは以下のような Ruby のコードで定義できます。

//emlist[例][ruby]{
def memsize_of_all klass = false
total = 0
ObjectSpace.each_object{|e|
total += ObjectSpace.memsize_of(e) if klass == false || e.kind_of?(klass)
}
total
end
//}

戻り値の内容は完全ではな...

Enumerable#partition {|item| ... } -> [[object], [object]] (6418.0)

各要素を、ブロックの条件を満たす要素と満たさない要素に分割します。 各要素に対してブロックを評価して、その値が真であった要素の配列と、 偽であった要素の配列の 2 つを配列に入れて返します。

...要素の配列と、
偽であった要素の配列の 2 つを配列に入れて返します。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0].partition {|i| i % 3 == 0 }
#=> [[9, 6, 3, 0], [10, 8, 7, 5, 4, 2, 1]]
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>