種類
ライブラリ
- ビルトイン (152)
-
cgi
/ core (12) -
cgi
/ session (48) -
cgi
/ session / pstore (12) -
cgi
/ util (12) - csv (108)
- date (1288)
- digest (12)
- fileutils (36)
-
json
/ add / date (12) -
json
/ add / date _ time (24) - logger (57)
-
net
/ imap (84) - nkf (24)
- open-uri (12)
- openssl (96)
- psych (19)
- rss (456)
-
rubygems
/ commands / update _ command (24) -
rubygems
/ config _ file (36) -
rubygems
/ doc _ manager (12) -
rubygems
/ source _ index (24) -
rubygems
/ source _ info _ cache (12) -
rubygems
/ specification (36) -
rubygems
/ user _ interaction (36) - time (144)
-
webrick
/ httpresponse (72) -
webrick
/ ssl (12) - win32ole (12)
クラス
- Array (12)
- CGI (24)
-
CGI
:: Session (12) -
CGI
:: Session :: FileStore (12) -
CGI
:: Session :: MemoryStore (12) -
CGI
:: Session :: NullStore (12) -
CGI
:: Session :: PStore (12) - CSV (60)
-
CSV
:: FieldInfo (36) - Date (878)
- DateTime (398)
-
Digest
:: Base (12) - Enumerator (6)
- Exception (24)
-
Gem
:: Commands :: UpdateCommand (24) -
Gem
:: ConfigFile (36) -
Gem
:: DocManager (12) -
Gem
:: SourceIndex (24) -
Gem
:: SourceInfoCache (12) -
Gem
:: Specification (36) -
Gem
:: StreamUI :: SilentProgressReporter (12) -
Gem
:: StreamUI :: SimpleProgressReporter (12) -
Gem
:: StreamUI :: VerboseProgressReporter (12) - Logger (33)
-
Logger
:: Formatter (24) - Module (12)
-
Net
:: IMAP (60) -
Net
:: IMAP :: ContentDisposition (12) -
Net
:: IMAP :: Envelope (12) - Object (12)
-
OpenSSL
:: Cipher (12) -
OpenSSL
:: Digest (12) -
OpenSSL
:: X509 :: CRL (48) -
RDoc
:: Options (12) -
RSS
:: ImageFaviconModel :: ImageFavicon (24) -
RSS
:: ImageItemModel :: ImageItem (24) -
RSS
:: Maker :: ChannelBase (24) -
RSS
:: Maker :: ItemsBase (12) -
RSS
:: Maker :: ItemsBase :: ItemBase (48) -
RSS
:: Parser (24) -
RSS
:: RDF :: Channel :: ImageFavicon (24) -
RSS
:: RDF :: Image (24) -
RSS
:: RDF :: Item (24) -
RSS
:: RDF :: Textinput (24) -
RSS
:: Rss :: Channel (24) -
RSS
:: Rss :: Channel :: Item (48) -
RSS
:: TaxonomyTopicModel :: TaxonomyTopic (24) - Random (24)
- Range (26)
- Time (192)
-
WEBrick
:: HTTPResponse (72)
モジュール
- DublinCoreModel (36)
- FileUtils (36)
-
Gem
:: InstallUpdateOptions (24) -
Gem
:: LocalRemoteOptions (12) - Kernel (36)
- NKF (24)
-
OpenSSL
:: X509 (24) -
OpenURI
:: Meta (12) - Psych (19)
-
RSS
:: SyndicationModel (72) -
WEBrick
:: Config (12) -
WIN32OLE
:: VARIANT (12)
キーワード
- - (12)
- <=> (12)
- == (12)
-
DEFAULT
_ UPDATE _ SOURCES (12) - DateTime (12)
- DateTimeMatcher (12)
- ENGLAND (12)
- GREGORIAN (12)
- ITALY (12)
- InstallUpdateOptions (12)
- JULIAN (12)
-
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NKF
_ RELEASE _ DATE (12) -
RUBY
_ RELEASE _ DATE (12) - SSL (12)
- VERSION (12)
-
VT
_ DATE (12) -
V
_ ERR _ ERROR _ IN _ CRL _ LAST _ UPDATE _ FIELD (12) -
V
_ ERR _ ERROR _ IN _ CRL _ NEXT _ UPDATE _ FIELD (12) - [] (12)
-
_ iso8601 (12) -
_ jisx0301 (12) -
_ strptime (24) -
add
_ update _ sources _ option (12) - ajd (12)
- amjd (12)
- append (12)
- asctime (12)
- autoload? (12)
-
backtrace
_ locations (12) - body= (12)
- chunked= (12)
- civil (24)
- commercial (24)
-
content
_ length (12) -
content
_ length= (12) - convert (24)
- copy (12)
- cp (12)
- ctime (12)
- cwday (12)
- cweek (12)
- cwyear (12)
- date= (120)
-
datetime
_ format (24) -
datetime
_ format= (24) - day (12)
-
dc
_ date (12) -
dc
_ date= (12) -
dc
_ dates (12) -
deconstruct
_ keys (4) -
do
_ rubygems _ update (12) -
do
_ sort= (12) -
do
_ validate (12) -
do
_ validate= (12) - downto (24)
- entries (7)
- eval (12)
-
force
_ update (12) - format (12)
-
format
_ date (12) -
format
_ datetime (12) - friday? (12)
- gregorian (12)
- gregorian? (12)
-
gregorian
_ leap? (12) - header (24)
- hour (12)
- httpdate (60)
- index (12)
-
install
_ update _ defaults _ str (12) - iso8601 (60)
- italy (12)
- jd (36)
- jisx0301 (48)
-
json
/ add / date _ time (12) -
json
_ create (12) - julian (12)
- julian? (12)
-
julian
_ leap? (12) - lastBuildDate (24)
- lastBuildDate= (24)
-
last
_ update (12) -
last
_ update= (12) - ld (12)
- leap? (12)
- line (12)
- mday (12)
- min (12)
- minute (12)
- mjd (12)
- mon (12)
- month (12)
- new (45)
-
new
_ offset (12) -
new
_ start (12) -
next
_ update (12) -
next
_ update= (12) - now (12)
- offset (12)
- ordinal (24)
- outdated (12)
- param (12)
- parse (48)
- produce (6)
- pubDate (24)
- pubDate= (24)
- rand (24)
-
rb
_ iterate (12) - rdoc (12)
-
rfc1123
_ date (12) - rfc2822 (60)
- rfc3339 (48)
- rfc822 (60)
-
ruby 1
. 6 feature (12) -
ruby 1
. 9 feature (12) -
safe
_ load (19) - sec (12)
-
sec
_ fraction (12) - second (12)
-
second
_ fraction (12) - sort (12)
- sprintf (12)
- start (12)
- step (24)
- strftime (24)
- strptime (48)
-
sy
_ updateBase (12) -
sy
_ updateBase= (12) -
sy
_ updateFrequency (12) -
sy
_ updateFrequency= (12) -
sy
_ updatePeriod (12) -
sy
_ updatePeriod= (12) - time (12)
-
to
_ a (7) -
to
_ csv (12) -
to
_ date (12) -
to
_ datetime (24) -
to
_ json (24) -
to
_ s (24) -
to
_ time (24) - today (24)
- tsort (12)
-
uid
_ sort (12) -
unconverted
_ fields? (12) - update (120)
-
update
_ ri _ cache (12) -
update
_ sources (12) -
update
_ sources= (12) - updated (36)
- uptodate? (12)
-
valid
_ civil? (12) -
valid
_ commercial? (12) -
valid
_ date? (12) -
valid
_ jd? (12) -
valid
_ ordinal? (12) - validate (12)
- wday (12)
-
which
_ to _ update (12) -
write
_ headers? (12) - xmlschema (60)
- yday (12)
- year (12)
- zone (12)
- パターンマッチ (3)
- リテラル (12)
検索結果
先頭5件
-
Random
# rand(range) -> Integer | Float (130.0) -
一様な擬似乱数を発生させます。
...e.end - range.begin が整数を返す場合は range.begin + self.rand((range.end - range.begin) + e)
の値を返します(e は終端を含む場合は1、含まない場合は0です)。
range.end - range.begin が実数を返す場合も同様です。
このため range が Time の場合な......どにもうまく動作します。
引数が実数でも範囲でもない場合は Object#to_int で変換した値が指定されたものとして扱います。
@param max 乱数値の上限を正の整数または実数で指定します。
max 自体は乱数値の範囲に......2年のすべての(秒単位)時刻から一つ選ばれる
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ... -
Range
. new(first , last , exclude _ end = false) -> Range (130.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...first から last までの範囲オブジェクトを生成して返しま
す。
exclude_end が真ならば終端を含まない範囲オブジェクトを生
成します。exclude_end 省略時には終端を含みます。
@param first 最初のオブジェクト
@param last 最後のオブ......raise ArgumentError first <=> last が nil の場合に発生します
//emlist[例: 整数の範囲オブジェクトの場合][ruby]{
Range.new(1, 10) # => 1..10
Range.new(1, 10, true) # => 1...10
//}
//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
requir......e 'date'
Range.new(Date.today, Date.today >> 1).each {|d| puts d }
# => 2017-09-16
# 2017-09-17
# ...
# 2017-10-16
//}
//emlist[例: IPアドレスの範囲オブジェクトの場合][ruby]{
require 'ipaddr'
Range.new(IPAddr.new("192.0.2.1"), IPAddr.new("192.0.2.3")).each {|ip| puts ip}
#... -
Array
# to _ csv(**options) -> String (112.0) -
CSV.generate_line(self, options) と同様です。
...erate_line(self, options) と同様です。
Array オブジェクトを 1 行の CSV 文字列に変換するためのショートカットです。
@param options CSV.generate_line と同様のオプションを指定します。
//emlist[][ruby]{
require 'csv'
p [1, 'Matz', :Ruby, Date.new(19......65, 4, 14)].to_csv # => "1,Matz,Ruby,1965-04-14\n"
p [1, 'Matz', :Ruby, Date.new(1965, 4, 14)].to_csv(col_sep: ' ', row_sep: "\r\n") # => "1 Matz Ruby 1965-04-14\r\n"
//}
@see CSV.generate_line......by, Date.new(1965, 4, 14)].to_csv(col_sep: ' ', row_sep: "\r\n") # => "1 Matz Ruby 1965-04-14\r\n"
//}
Ruby 3.0 (CSV 3.1.9) から、次のオプションが使えるようになりました。
//emlist[][ruby]{
require 'csv'
puts [1, nil].to_csv # => 1,
puts [1, nil].......to_csv(write_nil_value: "N/A") # => 1,N/A
puts [2, ""].to_csv # => 2,""
puts [2, ""].to_csv(write_empty_value: "BLANK") # => 2,BLANK
//}
@see CSV.generate_line... -
Enumerator
. produce(initial = nil) { |prev| . . . } -> Enumerator (112.0) -
与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。 ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。 initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック 呼び出しの引数として渡されます。initial が渡されなかった場合は nil が 渡されます。
...て渡されます。
initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック
呼び出しの引数として渡されます。initial が渡されなかった場合は nil が
渡されます。
ブロックが例外 StopIterationを投げた場合、......繰り返しが終了します。
@param initial ブロックに最初に渡される値です。任意のオブジェクトを渡せます。
//emlist[例][ruby]{
# 1, 2, 3, 4, ... と続く Enumerator
Enumerator.produce(1, &:succ)
# next を呼ぶたびランダムな数値を返す Enumerator......hile や until ループのような処理を実装できます。
例えば Enumerable#detect, Enumerable#slice_after, Enumerable#take_while
などと合わせて使えるでしょう。
//emlist[Enumerable のメソッドと組み合わせる例][ruby]{
# 次の火曜日を返す例
require "date... -
NEWS for Ruby 2
. 7 . 0 (42.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ルか bugs.ruby-lang.org の issue を参照してください。
== 2.6.0 以降の変更
=== 言語仕様の変更
==== パターンマッチ
* パターンマッチが実験的機能として導入されました。 14912
//emlist[][ruby]{
case [0, [1, 2, 3]]
in [a, [b, *c]]
p a #=> 0......nd
//}
//emlist[][ruby]{
case {a: 0, b: 1}
in {a: 0, x: 1}
:unreachable
in {a: 0, b: var}
p var #=> 1
end
//}
//emlist[][ruby]{
case -1
in 0 then :unreachable
in 1 then :unreachable
end #=> NoMatchingPatternError
//}
//emlist{
json = <<END
{
"name": "Alice",
"age": 30,
"children": [{ "n......azy#with_indexメソッドが追加され、
以前のlazyではないEnumerator#with_indexのデフォルト実装から
lazyになりました。7877
//emlist[Enumerator.produce][ruby]{
require "date"
dates = Enumerator.produce(Date.today, &:succ) #=> infinite sequence of dates
dates.det... -
tsort (30.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...ソートと強連結成分に関するモジュールを提供します。
=== Example
//emlist[][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsor......きます。
//emlist[][ruby]{
require 'tsort'
class Make
def initialize
@dep = {}
@dep.default = []
end
def rule(outputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @dep[f] = [triple]}
@dep[triple] = inputs
end
def build(target)
each......ts_time != nil && inputs_time.to_i == Time.now.to_i
block.call
end
end
}
end
def tsort_each_child(node, &block)
@dep[node].each(&block)
end
include TSort
end
def command(arg)
print arg, "\n"
system arg
end
m = Make.new
m.rule(%w[t1]) { command 'date > t... -
rdoc (24.0)
-
RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。
...ョンです。 JavaDoc と同様に、ソースを解析し、クラス、モ
ジュール、メソッドの定義を抜き出してきます(include,require もです)。そ
してこれらの内容とその直前に書かれたコメントを併合し、ドキュメントを出
力します(現......ください。
=== 概要
インストールすれば、'rdoc' コマンドでドキュメントが生成できます。
(Windows では 'rdoc.bat' です)
$ rdoc [options] [names...]
"rdoc --help" と打てば、最新のオプションに関する情報が得られます。
$ rdoc
こ......れているクラスは複数の四角にまたがった図が作られます。--diagram
といっしょに使わなければ意味のないオプションです。(実験的な機能です)
: --force-update
出力済みのファイルの方が新しい場合でも全てのファイルを更... -
NEWS for Ruby 3
. 0 . 0 (18.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting......single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]
pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}
* Arguments forwarding (`...`) now supports leadin......ue, and the standard input and output are tty, the `--help`
option shows the help message via the pager designated by the value.
16754
=== `--backtrace-limit` option
The `--backtrace-limit` option limits the maximum length of a backtrace.
8661
== Core classes updates
Outstanding ones only.
*...