るりまサーチ

最速Rubyリファレンスマニュアル検索!
72件ヒット [1-72件を表示] (0.020秒)
トップページ > クエリ:require[x] > クエリ:httpdate[x]

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

ライブラリ

クラス

キーワード

検索結果

Time.httpdate(date) -> Time (18119.0)

2616で定義されているHTTP-dateとしてdateをパースして Timeオブジェクトに変換します。

...現できないときに発生します。

require
'time'
rfc2616_time = 'Sun, 31 Aug 2008 12:34:56 GMT'

t = Time.httpdate(rfc2616_time)
p t.kind_of?(Time) #=> true

non_rfc2616_time = 'San, 31 Aug 2008 12:34:56 GMT'
begin
Time.httpdate(non_rfc2616_time)
rescue ArgumentError => e...

Time#httpdate -> String (18113.0)

2616 で定義されている HTTP-date の rfc1123-date 形式の文字列を 返します。

...を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss GMT
//}
注意: 結果はいつも UTC (GMT) です。

使用例
require
'time'

iso8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.httpdate #=> "Sun, 31 Aug 2008 03:34:56 GMT"...

Time.parse(date, now = Time.now) -> Time (30.0)

...ックによって変換されます。

require
'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}

与えられた時刻に上位の要素がなかったり壊れていた場合、nowの
該当要素が使われます。

require
'time'
time = Time.local(2019, 5, 1)...
...お、1.9.2より前は例外は発生せず、現在時刻を表す
Time のインスタンスを返していました。

require
'time'

# 現在時刻が "Thu Nov 29 14:33:20 GMT 2001" で
# タイムゾーンがGMTとすると:
Time.parse("16:30") #=> Thu Nov 29...
...ッドは他のパース用メソッドのフェイルセーフとして
以下のように使用できます:

require
'time'

Time.rfc2822(date) rescue Time.parse(date)
Time.httpdate(date) rescue Time.parse(date)
Time.xmlschema(date) rescue Time.parse(date)

従って Time.parse の失敗...

Time.parse(date, now = Time.now) {|year| year } -> Time (30.0)

...ックによって変換されます。

require
'time'
Time.parse(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}

与えられた時刻に上位の要素がなかったり壊れていた場合、nowの
該当要素が使われます。

require
'time'
time = Time.local(2019, 5, 1)...
...お、1.9.2より前は例外は発生せず、現在時刻を表す
Time のインスタンスを返していました。

require
'time'

# 現在時刻が "Thu Nov 29 14:33:20 GMT 2001" で
# タイムゾーンがGMTとすると:
Time.parse("16:30") #=> Thu Nov 29...
...ッドは他のパース用メソッドのフェイルセーフとして
以下のように使用できます:

require
'time'

Time.rfc2822(date) rescue Time.parse(date)
Time.httpdate(date) rescue Time.parse(date)
Time.xmlschema(date) rescue Time.parse(date)

従って Time.parse の失敗...

UnboundMethod#source_location -> [String, Integer] | nil (12.0)

ソースコードのファイル名と行番号を配列で返します。

...ない(つまりネイティブ
である)場合は nil を返します。

//emlist[例][ruby]{
require
'time'

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}

@s...

絞り込み条件を変える

WEBrick::HTTPResponse#[]=(field, val) (12.0)

レスポンスの該当するヘッダに val を設定します。

...せん。

@param val ヘッダの値を指定します。to_s メソッドによって文字列に変換されます。

require
'time'
res['last-modified'] = Time.now.httpdate

@see WEBrick::HTTPResponse#chunked?, WEBrick::HTTPResponse#content_length,
WEBrick::HTTPResponse#content_type...