種類
ライブラリ
- English (48)
- ビルトイン (253)
- abbrev (12)
- benchmark (12)
- bigdecimal (12)
- coverage (7)
- csv (360)
- dbm (24)
- delegate (12)
- fileutils (132)
- getoptlong (24)
- json (108)
- matrix (84)
- open3 (108)
- openssl (12)
- optparse (144)
- ostruct (10)
- pathname (12)
- pp (4)
- profiler (6)
- psych (8)
- rake (12)
-
rdoc
/ context (12) - readline (12)
-
rexml
/ document (12) -
rubygems
/ commands / which _ command (12) -
rubygems
/ dependency _ installer (24) -
rubygems
/ requirement (24) -
rubygems
/ specification (24) - scanf (12)
- set (45)
- shell (30)
-
shell
/ command-processor (6) -
shell
/ filter (6) - shellwords (12)
- socket (132)
- thwait (6)
- tsort (48)
-
webrick
/ config (12) -
webrick
/ httputils (24) - zlib (12)
クラス
- Array (93)
- BasicSocket (12)
- BigDecimal (12)
- CSV (168)
-
CSV
:: Row (36) -
CSV
:: Table (132) - Coverage (7)
- DBM (24)
-
Gem
:: Commands :: WhichCommand (12) -
Gem
:: DependencyInstaller (24) -
Gem
:: Requirement (24) -
Gem
:: Specification (24) - GetoptLong (24)
- IO (12)
- IPSocket (36)
-
JSON
:: Parser (12) -
JSON
:: State (60) - Matrix (36)
- Object (4)
-
OpenSSL
:: BN (12) - OpenStruct (10)
- OptionParser (144)
- Pathname (12)
-
RDoc
:: Context (12) -
REXML
:: Element (12) - Random (36)
- Range (14)
-
RubyVM
:: InstructionSequence (12) - Set (45)
- Shell (30)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - Socket (60)
- String (24)
- TCPSocket (12)
- ThreadsWait (6)
- UDPSocket (12)
- Vector (48)
-
WEBrick
:: HTTPUtils :: FormData (24) -
Zlib
:: GzipReader (12)
モジュール
- Benchmark (12)
- Enumerable (98)
- FileUtils (132)
- JSON (24)
-
JSON
:: Generator :: GeneratorMethods :: Array (12) - Kernel (60)
- Open3 (108)
- Psych (8)
-
Rake
:: TaskManager (12) - Shellwords (12)
- TSort (48)
-
WEBrick
:: Config (12)
オブジェクト
-
Readline
:: HISTORY (12)
キーワード
-
$ INPUT _ RECORD _ SEPARATOR (12) -
$ OFS (12) -
$ OUTPUT _ FIELD _ SEPARATOR (12) -
$ RS (12) - & (9)
- << (12)
-
ARGUMENT
_ FLAGS (12) - CSV (12)
- DelegateClass (12)
- DigestAuth (12)
-
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) - ORDERINGS (12)
-
Profiler
_ _ (6) - Ruby用語集 (12)
- [] (48)
- abbrev (12)
- accept (12)
-
add
_ attributes (12) -
add
_ to (12) - addr (12)
- all? (24)
- any? (32)
-
array
_ nl (12) -
array
_ nl= (12) - bmbm (12)
- chmod (12)
-
chmod
_ R (12) - chown (12)
-
chown
_ R (12) - coerce (36)
- collect2 (24)
-
collect
_ method (12) - commands (12)
- concat (12)
- converters (12)
-
default
_ system _ path (6) -
default
_ system _ path= (6) - diagonal (12)
- dig (10)
- empty? (12)
- entries (7)
- fcntl (12)
-
fiddle
/ import (12) - fields (12)
-
find
_ spec _ by _ name _ and _ version (12) - flatten (9)
- flatten! (9)
-
gem
_ paths (12) - generate (12)
-
generate
_ line (12) - getaddrinfo (12)
- gethostbyname (24)
- getnameinfo (12)
- gets (12)
-
header
_ converters (12) - headers (36)
- install (12)
- intersection (9)
- length (12)
-
line
_ stub (7) - list (12)
- makedirs (12)
- map2 (12)
- mkdir (18)
-
mkdir
_ p (12) - mkpath (12)
- new (36)
- none? (21)
- on (144)
- one? (21)
- pack (21)
- pack テンプレート文字列 (12)
- parse (36)
-
parse
_ line (12) - peeraddr (12)
- pipeline (12)
-
pipeline
_ r (24) -
pipeline
_ rw (24) -
pipeline
_ start (24) -
pipeline
_ w (24) -
pretty
_ print (4) - rand (36)
- read (24)
- readline (12)
- readlines (36)
- recvfrom (12)
-
recvfrom
_ nonblock (12) -
required
_ attributes (12) - requirements (12)
- rss (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
safe
_ load (8) - sample (48)
- scanf (12)
- select (12)
- sendmsg (12)
- set (9)
- shelljoin (12)
- shellwords (12)
- shift (12)
- size (12)
- split (12)
-
strongly
_ connected _ components (24) -
system
_ path (6) -
system
_ path= (6) - tasks (12)
- threads (6)
-
to
_ a (76) -
to
_ ary (12) -
to
_ csv (12) -
to
_ h (12) -
to
_ hash (12) -
to
_ json (12) - tsort (36)
- unpack (12)
-
unpack
_ sockaddr _ in (12) - unparse (12)
-
values
_ at (24) - yaml (12)
- このマニュアルのヘルプ (12)
- 制御構造 (9)
検索結果
先頭5件
-
Array
# sample(n) -> Array (21108.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}
random SecureRandom などの乱数生成器を渡すことができます。
//emlist[例][ruby]{
require 'securerandom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Array
# sample(n , random: Random) -> Array (21108.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}
random SecureRandom などの乱数生成器を渡すことができます。
//emlist[例][ruby]{
require 'securerandom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Array
# pack(template) -> String (21030.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...template 自身のバイナリとしてパックするためのテンプレートを文字列で指定します。
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けること......endian int32_t
l!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰......ong(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}
: IPアドレス
//emlist[][ruby]{
require 'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| addre......ます。
指定した場合は返値も指定した文字列オブジェクトになります。
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を... -
Array
# pack(template , buffer: String . new) -> String (21030.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...ます。
指定した場合は返値も指定した文字列オブジェクトになります。
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を......endian int32_t
l!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰......ong(その2)
//emlist[][ruby]{
s = "\xFF\xFF\xFF\xFE"
n = s.unpack("N").pack("l").unpack("l")[0]
n # => -2
//}
: IPアドレス
//emlist[][ruby]{
require 'socket'
official_hostname, alias_hostnames, address_family, *address_list = Socket.gethostbyname("localhost")
address_list.find {|address| addre... -
Array
# to _ csv(**options) -> String (21018.0) -
CSV.generate_line(self, options) と同様です。
...ate_line(self, options) と同様です。
Array オブジェクトを 1 行の CSV 文字列に変換するためのショートカットです。
@param options CSV.generate_line と同様のオプションを指定します。
//emlist[][ruby]{
require 'csv'
p [1, 'Matz', :Ruby, Date.new(1965......=> "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... -
Array
# sample -> object | nil (21008.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}
random SecureRandom などの乱数生成器を渡すことができます。
//emlist[例][ruby]{
require 'securerandom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Array
# sample(random: Random) -> object | nil (21008.0) -
配列の要素を1個(引数を指定した場合は自身の要素数を越えない範囲で n 個) ランダムに選んで返します。
...a.sample #=> 10
p a.sample(3) #=> [1, 9, 3]
p a #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}
random SecureRandom などの乱数生成器を渡すことができます。
//emlist[例][ruby]{
require 'securerandom'
a = (1..10).to_a
p a.sample(random: SecureRandom) #=> 2
//}... -
Array
# abbrev(pattern = nil) -> Hash (21006.0) -
self が文字列の配列の場合、self から一意に決まる短縮形を計算し、 短縮形をキー、元の文字列を値とするハッシュを返します。
...から短縮形を計算します。
Abbrev.#abbrev(self, pattern) と同じです。
@param pattern Regexp か String を指定します。
require 'abbrev'
p %w[ruby rubyist].abbrev
#=> {"ruby" => "ruby",
# "rubyi" => "rubyist",
# "rubyis" => "rubyist",
# "rubyist" =... -
Gem
:: Specification # requirements -> Array (6201.0) -
この Gem パッケージを動作させるのに必要な条件を返します。 これはユーザのためのシンプルな情報です。
この Gem パッケージを動作させるのに必要な条件を返します。
これはユーザのためのシンプルな情報です。