50件ヒット
[1-50件を表示]
(0.121秒)
キーワード
- === (17)
-
backtrace
_ locations (11) - header (11)
検索結果
先頭5件
-
Date
# ===(other) -> bool (29201.0) -
同じ日なら真を返します。
同じ日なら真を返します。
@param other 日付オブジェクト -
Exception
# ==(other) -> bool (18147.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......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
# ===(obj) -> bool (12243.0) -
始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。
...き、true を返します。
そうでないとき、false を返します。
Range#=== は主に case 式での比較に用いられます。
//emlist[例][ruby]{
p (0...50) === 79 #=> false
p (60...80) === 79 #=> true
case 79
when 0...60 then puts "low"
when 60...80 then puts "medium" #......=== は、Range#cover? のように Range オブジェクトを引数にはとる設計はありません。
//emlist[例][ruby]{
require 'date'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.......today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は、include? と同じく比較できず false を返していました。
//}
@see d:spec/control#case
@see Range#include?, Range#cover?.......today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は、include? と同じく比較できず false を返していました。
//}
2.7 以降の === は、文字列も Range#cover? と同様の処理をするようになりました。
//emlist[例][ruby]{
p (... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (19.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...acktrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][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... -
CGI
# header(options = "text / html") -> String (13.0) -
HTTP ヘッダを options に従って生成します。 CGI#out と違い、標準出力には出力しません。 CGI#out を使わずに自力で HTML を出力したい場合などに使います。 このメソッドは文字列エンコーディングを変換しません。
...tent-Type ヘッダに追加します。
: nph
真偽値を指定します。真ならば、HTTP のバージョン、ステータスコード、
Date ヘッダをセットします。また Server と Connection の各ヘッダにもデフォルト値をセットします。
偽を指定す......ml
header("text/plain")
# Content-Type: text/plain
header({"nph" => true,
"status" => "OK", # == "200 OK"
# "status" => "200 GOOD",
"server" => ENV['SERVER_SOFTWARE'],
"connection" => "c...