798件ヒット
[1-100件を表示]
(0.212秒)
ライブラリ
クラス
- Array (148)
- BasicObject (48)
-
DRb
:: DRbObject (24) - Delegator (12)
-
Enumerator
:: Lazy (11) - KeyError (8)
- Method (32)
- Object (84)
- Pathname (12)
- Prime (12)
- Range (104)
-
Rinda
:: DRbObjectTemplate (12) - SDBM (12)
- Set (24)
- String (12)
- Time (24)
モジュール
- Enumerable (207)
-
Rake
:: Cloneable (12)
キーワード
- != (12)
- === (32)
- [] (8)
-
_ _ id _ _ (12) - call (16)
-
chunk
_ while (12) - clone (24)
- count (24)
- delete (24)
- detect (12)
- divide (24)
- dup (12)
- each (12)
- eql? (24)
- equal? (12)
- filter (7)
- find (12)
-
find
_ all (12) -
find
_ index (12) - getlocal (24)
- hash (12)
- itself (12)
- join (12)
- key (8)
- max (88)
- min (88)
- minmax (12)
- one? (15)
- pack (21)
- partition (12)
- reject (48)
- reject! (36)
- select (12)
-
slice
_ when (11) - sort (24)
- unpack (12)
検索結果
先頭5件
-
Object
# ==(other) -> bool (24225.0) -
オブジェクトと other が等しければ真を返します。
...オブジェクトと other が等しければ真を返します。
このメソッドは各クラスの性質に合わせて再定義すべきです。
多くの場合、オブジェクトの内容が等しければ真を返すように
(同値性を判定するように)再定義されるこ......す。
@param other 比較するオブジェクトです。
//emlist[例][ruby]{
o = Object.new
p(o.eql?(o)) #=> true
p(o.eql?(Object.new)) #=> false
//}
下記の例のように、各クラスの性質に合わせて再定義されることが期待されています。
//emlist[適切に再定......義されている例][ruby]{
p("foo" == "bar") #=> false
p("foo" == "foo") #=> true
p(4 == 4) #=> true
p(4 == 4.0) #=> true
//}
@see Object#equal?,Object#eql?... -
BasicObject
# ==(other) -> bool (24213.0) -
オブジェクトが other と等しければ真を、そうでない場合は偽を返します。
...オブジェクトが other と等しければ真を、そうでない場合は偽を返します。
このメソッドは各クラスの性質に合わせて、サブクラスで再定義するべきです。
多くの場合、オブジェクトの内容が等しければ真を返すように (同......ルトでは Object#equal? と同じオブジェクトの同一性になっています。
@param other 比較対象となるオブジェクト
@return other が self と同値であれば真、そうでない場合は偽
//emlist[例][ruby]{
class Person < BasicObject
def initialize(name, age)......@name = 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?... -
DRb
:: DRbObject # ==(other) -> bool (24201.0) -
DRb::DRbObject オブジェクト同士が同じであるなら真を返します。
...DRb::DRbObject オブジェクト同士が同じであるなら真を返します。
この同値判定は、
オブジェクトが参照している URI と識別子が等しいかどうかでします。... -
Delegator
# ==(obj) -> bool (21201.0) -
自身が与えられたオブジェクトと等しい場合は、真を返します。 そうでない場合は、偽を返します。
...自身が与えられたオブジェクトと等しい場合は、真を返します。
そうでない場合は、偽を返します。
@param obj 比較対象のオブジェクトを指定します。... -
Object
# ===(other) -> bool (18307.0) -
case 式で使用されるメソッドです。d:spec/control#case も参照してください。
...spec/control#case も参照してください。
このメソッドは case 式での振る舞いを考慮して、
各クラスの性質に合わせて再定義すべきです。
デフォルトでは内部で Object#== を呼び出します。
when 節の式をレシーバーとして === を......ther 比較するオブジェクトです。
//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12), ... が実行される
result =
case age
when 0 .. 2
"baby"
when 3 .. 6
"little child"
when 7 .. 12
"child"
when 13 .. 18
"youth"
else
"adult"
end
puts result......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#===... -
Rinda
:: DRbObjectTemplate # ===(ro) (18201.0) -
@todo
...@todo
This DRbObjectTemplate matches +ro+ if the remote object's drburi
and drbref are the same. +nil+ is used as a wildcard.... -
Method
# ===(*args) -> object (15401.0) -
メソッドオブジェクトに封入されているメソッドを起動します。
...せん。
@param args self に渡される引数。
@see spec/safelevel
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}......f に渡される引数。
@see UnboundMethod#bind_call
@see spec/safelevel
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}......@param args self に渡される引数。
@see UnboundMethod#bind_call
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}... -
Enumerable
# partition {|item| . . . } -> [[object] , [object]] (12407.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]]
//}... -
Array
# reject {|item| . . . } -> [object] (12307.0) -
各要素に対してブロックを評価し、 その値が偽であった要素を集めた新しい配列を返します。 条件を反転させた select です。
...を返します。
条件を反転させた select です。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
[1, 2, 3, 4, 5, 6].reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}
@see Array#select, Enumerable#reject......件を反転させた select です。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
[1, 2, 3, 4, 5, 6].reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}
@see Array#select, Enumerable#reject
@see Enumerable#grep_v...