るりまサーチ

最速Rubyリファレンスマニュアル検索!
847件ヒット [1-100件を表示] (0.105秒)
トップページ > クエリ:i[x] > クエリ:end[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 ... > >>

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

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

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

@param other 自身と比較したいオブジェクトを指定します。...
...Exception#exception を実行して変換を試みます。

//emlist[例][ruby]{
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...
...ception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map { |e| e.message }
# => ["2 is not long month", "2 is not long month", "4 is not long month"]

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

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

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

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

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ 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#e...

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

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

...//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#==, Obje...

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

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

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

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

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

Rake::FileList#==(array) -> bool (21112.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

//}...

絞り込み条件を変える

Thread.pending_interrupt?(error = nil) -> bool (18330.0)

非同期割り込みのキューが空かどうかを返します。

...Thread.handle_interrupt は非同期割り込みの発生を延期させるのに使
用しますが、本メソッドは任意の非同期割り込みが存在するかどうかを確認す
るのに使用します。

本メソッドが true を返した場合、Thread.handle_interrupt で例外...
...だちに発生させる。

def Thread.kick_interrupt_immediately
Thread.handle_interrupt(Object => :immediate) {
Thread.pass
}
end


==
= 使い方

th = Thread.new{
Thread.handle_interrupt(RuntimeError => :on_blocking){
while true
...
# ここまでで...
...
i
f Thread.pending_interrupt?
Thread.handle_interrupt(Object => :immediate){}
end

...
end

}
}
...
th.raise # スレッド停止。

この例は以下のように記述する事もできます。

flag = true
th = Thread.new{
Thread.handle_in...

Regexp#===(string) -> bool (12306.0)

文字列 string との正規表現マッチを行います。 マッチした場合は真を返します。

...文字列 string との正規表現マッチを行います。
マッチした場合は真を返します。

string が文字列でもシンボルでもない場合には false を返します。

このメソッドは主にcase文での比較に用いられます。

@param string マッチ対象...
...文字列

//emlist[例][ruby]{
a = "HELLO"
case a
when /\A[a-z]*\z/; puts "Lower case"
when /\A[A-Z]*\z/; puts "Upper case"
else; puts "Mixed case"
end

# => Upper case

/\A[a-z]*\z/ === "HELLO" # => false
/\A[A-Z]*\z/ === "HELLO" # => true
//}

@see Enumerable#grep, Object#===...

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

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

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

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ 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#e...

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

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

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

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

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

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

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

Binding#local_variable_defined?(symbol) -> bool (12112.0)

引数 symbol で指定した名前のローカル変数が定義されている場合に true を、 そうでない場合に false を返します。

...//emlist[例][ruby]{
def foo
a = 1
binding.local_variable_defined?(:a) # => true
binding.local_variable_defined?(:b) # => false
end

//}

このメソッドは以下のコードの短縮形です。

//emlist[][ruby]{
binding.eval("defined?(#{symbol}) == 'local-variable'")
//}

@see Binding#lo...
...cal_variable_get, Binding#local_variable_set...

絞り込み条件を変える

<< 1 2 3 ... > >>