種類
- インスタンスメソッド (66)
- 特異メソッド (33)
- 文書 (27)
- モジュール関数 (22)
- ライブラリ (22)
ライブラリ
- ビルトイン (33)
- date (33)
-
webrick
/ httpresponse (55)
クラス
- Date (11)
- DateTime (22)
- Range (11)
-
WEBrick
:: HTTPResponse (55)
モジュール
- Kernel (22)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - body= (11)
- chunked= (11)
-
content
_ length (11) -
content
_ length= (11) - format (11)
- new (11)
-
optparse
/ date (11) - parse (11)
- rss (11)
-
ruby 1
. 6 feature (11) - sprintf (11)
- strptime (11)
検索結果
先頭5件
- Date
# to _ s -> String - WEBrick
:: HTTPResponse # to _ s -> String - DateTime
. parse(str = & # 39;-4712-01-01T00:00:00+00:00& # 39; , complete = true , start = Date :: ITALY) -> DateTime - DateTime
. strptime(str = & # 39;-4712-01-01T00:00:00+00:00& # 39; , format = & # 39;%FT%T%z& # 39; , start = Date :: ITALY) -> DateTime - optparse
/ date
-
Date
# to _ s -> String (35101.0) -
8601 書式の文字列を返します (拡大表記 ('%Y-%m-%d') を使います)。
8601 書式の文字列を返します (拡大表記 ('%Y-%m-%d') を使います)。 -
WEBrick
:: HTTPResponse # to _ s -> String (18113.0) -
実際にクライアントに送られるデータを文字列として返します。
...列として返します。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Length: 4
hoge... -
DateTime
. parse(str = & # 39;-4712-01-01T00:00:00+00:00& # 39; , complete = true , start = Date :: ITALY) -> DateTime (11225.0) -
与えられた日時表現を解析し、 その情報に基づいて DateTime オブジェクトを生成します。
...与えられた日時表現を解析し、
その情報に基づいて DateTime オブジェクトを生成します。
年が "00" から "99" の範囲であれば、
年の下2桁表現であるとみなしこれを補います。
この振舞いを抑止したい場合は、ヒントとして......オ暦をつかい始めた日をあらわすユリウス日
@raise ArgumentError 正しくない日時になる組み合わせである場合に発生します。
例:
require 'date'
DateTime.parse('2001-02-03T12:13:14Z').to_s
# => "2001-02-03T12:13:14+00:00"
@see Date._parse, Date.parse... -
DateTime
. strptime(str = & # 39;-4712-01-01T00:00:00+00:00& # 39; , format = & # 39;%FT%T%z& # 39; , start = Date :: ITALY) -> DateTime (11225.0) -
与えられた雛型で日時表現を解析し、 その情報に基づいて DateTime オブジェクトを生成します。
...与えられた雛型で日時表現を解析し、
その情報に基づいて DateTime オブジェクトを生成します。
@param str 日時をあらわす文字列
@param format 書式
@param start グレゴリオ暦をつかい始めた日をあらわすユリウス日
@raise ArgumentError......正しくない日時になる組み合わせである場合に発生します。
例:
require 'date'
DateTime.strptime('2001-02-03T12:13:14Z').to_s
# => "2001-02-03T12:13:14+00:00"
@see Date.strptime, DateTime._strptime, strptime(3), Date#strftime... -
optparse
/ date (6040.0) -
OptionParser#on で使用可能なクラスに Date と DateTime が 追加されます。 オプションの引数はそれぞれのクラスのインスタンスに変換されてから、 OptionParser#on のブロックに渡されます。
...スに Date と DateTime が
追加されます。
オプションの引数はそれぞれのクラスのインスタンスに変換されてから、
OptionParser#on のブロックに渡されます。
//emlist[][ruby]{
require 'optparse/date'
opts = OptionParser.new
opts.on("-d DATE", Date){|d|......p d.to_s #=> 2000-01-01
}
opts.parse!
# ruby command -d 2000/1/1
//}... -
rss (198.0)
-
RSS を扱うためのライブラリです。
...い.
=== 出力
RSS Parserといっているので誤解されがちですが,RSS/Atomを出力する
こともできます.
==== 基本
to_sするとRSSまたはAtom形式の文字列を返します.
RSS/Atomを出力する流れは以下のようになります.
* RSS/Atomオブ......RSS::Atom::Feedのオブジェクト)を作成する
* 出力エンコーディングを指定する(省略可)
* RSSオブジェクトのto_sメソッドを呼ぶ
==== xml-stylesheet
xml-stylesheetも出力することができます.
RSSのルート要素(RSS::RDFまたはRSS::Rss......ample.com/article.html"
item.title = "Sample Article"
item.date = Time.parse("2004/11/1 10:10")
end
end
サンプル中の
item.date = ...
は
item.dc_date = ...
でも構いません.#dc_date=は#date=の単なる別名で
す.
===== さらにエントリを追加... -
NEWS for Ruby 2
. 7 . 0 (78.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...Numbered parameters)がデフォルトのブロックの仮引数として
導入されました。 4475
//emlist[][ruby]{
[1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"]
[[1, 2], [3, 4]].map { _1 + _2 } #=> [3, 7]
//}
* 「_1」などはまだローカル変数名として使えて......た。 15323
* Enumerable#tallyが追加されました。 11076
//emlist[Enumerable#filter_map][ruby]{
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
//}
//emlist[Enumerable#tally][ruby]{
["A", "B", "C", "B", "A"].tally #=> {"A"=>2, "B"=>2, "C"=>1}
//}
* Enumerator
*......デフォルト実装から
lazyになりました。7877
//emlist[Enumerator.produce][ruby]{
require "date"
dates = Enumerator.produce(Date.today, &:succ) #=> infinite sequence of dates
dates.detect(&:tuesday?) #=> next Tuesday
//}
//emlist[Enumerator::Lazy#eager][ruby]{
a = %w(foo bar baz)
e = a... -
Range
. new(first , last , exclude _ end = false) -> Range (30.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...0
Range.new(1, 10, true) # => 1...10
//}
//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
Range.new(Date.today, Date.today >> 1).each {|d| puts d }
# => 2017-09-16
# 2017-09-17
# ...
# 2017-10-16
//}
//emlist[例: IPアドレスの範囲オ......のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end
def <=>(other)
value <=> other.value
end
def to_s
value.to_s
end
end
Range.new(MyInteger.new(1), MyInteger.new(3)).each {|i| puts i }
# => 1
# 2
# 3
//}... -
NEWS for Ruby 2
. 5 . 0 (18.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...11547
* do/end ブロック内部で rescue/else/ensure を書けるようになりました 12906
* 文字列の式展開内部の暗黙の to_s 呼び出しにも refinements が影響するようになりました 13812
=== 組み込みクラスの更新
* Array
* Array#append を......ml
* https://blog.rubygems.org/2017/08/27/2.6.13-released.html
* securerandom
* SecureRandom.alphanumeric を追加
* set
* Set#to_s を Set#inspect の別名として追加 13676
* Set#=== を Set#include? の別名として追加 13801
* Set#reset 6589
* stringio......修正を除く)
* Gemification
* 以下の標準添付ライブラリをdefault gemsに変更しました
* cmath
* csv
* date
* dbm
* etc
* fcntl
* fiddle
* fileutils
* gdbm
* ipaddr
* scanf
* sdbm
* stringio... -
NEWS for Ruby 3
. 0 . 0 (18.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...the value.
16754
=== `--backtrace-limit` option
The `--backtrace-limit` option limits the maximum length of a backtrace.
8661
== Core classes updates
Outstanding ones only.
* Array
* The following methods now return Array instances instead of subclass instances when called on subclass in......updates
Outstanding ones only.
* BigDecimal
* Update to BigDecimal 3.0.0
* This version is Ractor compatible.
* Bundler
* Update to Bundler 2.2.3
* CGI
* Update to 0.2.0
* This version is Ractor compatible.
* CSV
* Update to CSV 3.1.9
* Date
* Update to Date 3......tinuously improve the coverage of language features, analysis performance, and usability.
//emlist[][ruby]{
# test.rb
def foo(x)
if x > 10
x.to_s
else
nil
end
end
foo(42)
//}
//emlist{
$ typeprof test.rb
# Classes
class Object
def foo : (Integer) -> String?
end
//}
== Miscellaneo... -
Kernel
. # format(format , *arg) -> String (12.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...す。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
=== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。た......グ `-' と幅 の指定だけが意味を持ちます。
: s
文字列を出力します。
引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。
: p
Object#inspect の結果を出力します。
//emlist[][r...