るりまサーチ

最速Rubyリファレンスマニュアル検索!
617件ヒット [1-100件を表示] (0.061秒)

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. zlib end

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Exception#==(other) -> bool (18159.0)

自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。

...身と指定された other のクラスが同じであり、
message と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。

@
param other 自身と比較したいオブジェクトを指定します。...
...uby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end


def get_exception
return begin
yield
rescue => e
e
end

end


results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map {...
...is not long month", "2 is not long month", "4 is not long month"]

# class, message, backtrace が同一のため true になる
p results[0] == results[1] # => true

# class, backtrace が同一だが、message がことなるため false になる
p results[0] == results[2] # => false
//}...

Range#==(other) -> bool (18157.0)

指定された other が Range クラスのインスタンスであり、 始端と終端が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に true を返します。そうでない場合に false を返します。

...始端と終端が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に
true を返します。そうでない場合に false を返します。

@
param other 自身と比較したいオブジェクトを指定します。

//emlist[例][ruby]{
p (1..2) == (1..2)...
...# => true
p (1..2) == (1...2) # => false
p (1..2) == Range.new(1.0, 2.0) # => true
//}...

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

オブジェクトが other と等しければ真を、そうでない場合は偽を返します。

...になっています。

@
param other 比較対象となるオブジェクト
@
return other が self と同値であれば真、そうでない場合は偽

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

end


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

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

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

String#==(other) -> bool (18155.0)

other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

... == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false を返します。

@
param other 任意のオブジェクト
@
return true か false

//emlist[例][ruby]{
stringlike = Object.new

def stringlike.==(other)
"string" ==...
...other
end


p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> false

def stringlike.to_str
raise
end


p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> true
//}

@
see String#eql?...

Enumerator::ArithmeticSequence#==(other) -> bool (18119.0)

Enumerable::ArithmeticSequence として等しいか判定します。

...Enumerable::ArithmeticSequence として等しいか判定します。

other が Enumerable::ArithmeticSequence で
begin, end, step, exclude_end? が等しい時に
true を返します。

@
param other 自身と比較する Enumerable::ArithmeticSequence...

絞り込み条件を変える

Rake::FileList#==(array) -> bool (18119.0)

自身を配列に変換してから与えられた配列と比較します。

...列と比較します。

@
param array 比較対象の配列を指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new('lib/**/*.rb', 'test/test*.rb')
file_list == file_list.to_a # => true
end

//}...

Method#===(*args) -> object (12231.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...ソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
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]...

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

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

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

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

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

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

//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12),...
...ild"
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 i...
...n 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...

Proc#===(*arg) -> () (12231.0)

手続きオブジェクトを実行してその結果を返します。

...c#lambda? を参照してください。

===」は when の所に手続きを渡せるようにするためのものです。

//emlist[例][ruby]{
def sign(n)
case n
when lambda{|n| n > 0} then 1
when lambda{|n| n < 0} then -1
else 0
end

end


p sign(-4) #=> -1
p sign(0) #=> 0
p sign(...
...fib = lambda{|n|
case n
when 0 then 0
when 1 then 1
else
fib.(n - 2) + fib.(n - 1)
end

}
fib.(10) # => 55
//}



@
param arg 手続きオブジェクトに与える引数を指定します。

@
raise LocalJumpError Procを生成したメソッドからリターンしてしまった場...

Method#===(*args) -> object (12225.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 cal...
...の [] メソッドとの意味的な関連性はありません。


@
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] # => "fo...

絞り込み条件を変える

Module#===(obj) -> bool (12219.0)

指定された obj が self かそのサブクラスのインスタンスであるとき真を返します。 また、obj が self をインクルードしたクラスかそのサブクラスのインスタンスである場合にも 真を返します。上記のいずれでもない場合に false を返します。

...ルの所属関係をチェックすることになります。

//emlist[例][ruby]{
str = String.new
case str
when String # String === str を評価する
p true # => true
end

//}

@
param obj 任意のオブジェクト

@
see Object#kind_of?, Object#instance_of?, d:spec/control#case...
<< 1 2 3 ... > >>