103件ヒット
[1-100件を表示]
(0.127秒)
ライブラリ
- ビルトイン (27)
- pathname (54)
- rake (11)
-
webrick
/ httpresponse (11)
クラス
- Pathname (54)
-
Rake
:: EarlyTime (11) - String (11)
- Time (16)
-
WEBrick
:: HTTPResponse (11)
検索結果
先頭5件
-
Time
# to _ s -> String (27120.0) -
時刻を文字列に変換した結果を返します。 以下のようにフォーマット文字列を使って strftime を呼び出すのと同じです。
...字列を使って strftime を呼び出すのと同じです。
//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5,6)
p t.to_s # => "2000-01-02 03:04:05 +0900"
p t.strftime("%Y-%m-%d %H:%M:%S %z") # => "2000-01-02 03:04:05 +0900"
p t.utc.to_s......# => "2000-01-01 18:04:05 UTC"
p t.strftime("%Y-%m-%d %H:%M:%S UTC") # => "2000-01-01 18:04:05 UTC"
//}
戻り値の文字エンコーディングは Encoding::US_ASCII です。... -
Rake
:: EarlyTime # to _ s -> String (21118.0) -
"<EARLY TIME>" という文字列を返します。
..."<EARLY TIME>" という文字列を返します。... -
Time
# inspect -> String (9019.0) -
時刻を文字列に変換した結果を返します。
...刻を文字列に変換した結果を返します。
Time#to_s とは異なりナノ秒まで含めて返します。
//emlist[][ruby]{
t = Time.now
t.inspect #=> "2012-11-10 18:16:12.261257655 +0100"
t.strftime "%Y-%m-%d %H:%M:%S.%N %z" #=> "2012-11-10 18:16:12.2612......57655 +0100"
t.utc.inspect #=> "2012-11-10 17:16:12.261257655 UTC"
t.strftime "%Y-%m-%d %H:%M:%S.%N UTC" #=> "2012-11-10 17:16:12.261257655 UTC"
//}
戻り値の文字エンコーディングは Encoding::US_ASCII です。... -
Pathname
# utime(atime , mtime) -> Integer (6329.0) -
File.utime(atime, mtime, self.to_s) と同じです。
...File.utime(atime, mtime, self.to_s) と同じです。
@param atime 最終アクセス時刻を Time か、起算時からの経過秒数を数値で指定します。
@param mtime 更新時刻を Time か、起算時からの経過秒数を数値で指定します。
@see File.utime... -
Pathname
# atime -> Time (6218.0) -
File.atime(self.to_s) を渡したものと同じです。
...File.atime(self.to_s) を渡したものと同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.atime # => 2018-12-18 20:58:13 +0900
//}
@see File.atime... -
Pathname
# birthtime -> Time (6218.0) -
File.birthtime(self.to_s) を渡したものと同じです。
...File.birthtime(self.to_s) を渡したものと同じです。
@raise NotImplementedError Windows のような birthtime のない環境で発生します。
@see File.birthtime... -
Pathname
# ctime -> Time (6218.0) -
File.ctime(self.to_s) を渡したものと同じです。
....ctime(self.to_s) を渡したものと同じです。
//emlist[例][ruby]{
require 'pathname'
IO.write("testfile", "test")
pathname = Pathname("testfile")
pathname.ctime # => 2019-01-14 00:39:51 +0900
sleep 1
pathname.chmod(0755)
pathname.ctime # => 2019-01-14 00:39:52 +0900
//}
@see File.ctime... -
Pathname
# mtime -> Time (6218.0) -
File.mtime(self.to_s) を渡したものと同じです。
...File.mtime(self.to_s) を渡したものと同じです。
@see File.mtime... -
WEBrick
:: HTTPResponse # []=(field , val) (19.0) -
レスポンスの該当するヘッダに val を設定します。
...大文字と小文字を区別しません。
@param val ヘッダの値を指定します。to_s メソッドによって文字列に変換されます。
require 'time'
res['last-modified'] = Time.now.httpdate
@see WEBrick::HTTPResponse#chunked?, WEBrick::HTTPResponse#content_length,... -
String
# %(args) -> String (13.0) -
printf と同じ規則に従って args をフォーマットします。
...グ `-' と幅 の指定だけが意味を持ちます。
: s
文字列を出力します。
引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。
: p
Object#inspect の結果を出力します。
//emlist[][r......況によってフォーマットを変えたいが引数の順序を変えたくない場合に使
用します。
//emlist[][ruby]{
case ENV['LC_TIME']
when /^ja_JP/
fmt = "%1$d年%2$d月%3$d日"
else
fmt = "%2$02d/%03$2d/%1$02d"
end
p sprintf(fmt, 1, 4, 22) #=> "04/22/01"
//}
"*" の後に...