別のキーワード
ライブラリ
- ビルトイン (1128)
-
cgi
/ core (12) - csv (24)
- forwardable (24)
- json (24)
-
net
/ http (144) -
rexml
/ document (24) - set (18)
- thread (6)
クラス
-
ARGF
. class (12) - Array (492)
- CGI (12)
-
CSV
:: Table (24) - Encoding (12)
- File (12)
- Hash (24)
- Integer (24)
-
JSON
:: State (24) - MatchData (72)
-
Net
:: HTTPGenericRequest (24) -
REXML
:: Attributes (24) - Range (104)
- Set (24)
- String (24)
- Struct (24)
- Thread (24)
-
Thread
:: Queue (36)
モジュール
- Enumerable (268)
- Forwardable (24)
-
Net
:: HTTPHeader (120)
キーワード
- [] (96)
- []= (36)
- at (12)
-
backtrace
_ locations (24) -
bit
_ length (12) -
body
_ stream (12) -
body
_ stream= (12) - chunk (12)
-
chunk
_ while (12) - clear (12)
- combination (24)
-
content
_ length (12) -
content
_ length= (12) -
content
_ range (12) - delegate (12)
- delete (12)
- dummy? (12)
- fetch (36)
- fill (72)
-
get
_ fields (12) - header (12)
-
instance
_ delegate (12) - max (82)
-
max
_ by (48) - min (82)
-
min
_ by (48) - minmax (48)
-
minmax
_ by (24) - none? (53)
- one? (53)
- permutation (24)
-
range
_ length (12) - read (12)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - sample (48)
- size (120)
-
slice
_ before (24) -
slice
_ when (12) -
sort
_ by! (24) - sum (18)
-
to
_ h (12) -
to
_ hash (12) - truncate (12)
検索結果
先頭5件
-
Enumerable
# minmax _ by -> Enumerator (19.0) -
Enumerable オブジェクトの各要素をブロックに渡して評価し、その結果を <=> で比較して 最小の要素と最大の要素を要素とするサイズ 2 の配列を返します。
...sort と sort_by の違いと同じです。
詳細は Enumerable#sort_by を参照してください。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax_by {|x| x.length } #=> ["dog", "albatross"]
[].minmax_by{} # => [nil, nil]
//}
ブロックを省略した場合は Enumerator を... -
Enumerable
# minmax _ by {|obj| . . . } -> [object , object] (19.0) -
Enumerable オブジェクトの各要素をブロックに渡して評価し、その結果を <=> で比較して 最小の要素と最大の要素を要素とするサイズ 2 の配列を返します。
...sort と sort_by の違いと同じです。
詳細は Enumerable#sort_by を参照してください。
//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax_by {|x| x.length } #=> ["dog", "albatross"]
[].minmax_by{} # => [nil, nil]
//}
ブロックを省略した場合は Enumerator を... -
Enumerable
# slice _ when {|elt _ before , elt _ after| bool } -> Enumerator (19.0) -
要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け た(グループ化した)要素を持つEnumerator を返します。
...も有用です。
//emlist[例][ruby]{
# 1ずつ増加する部分配列ごとに分ける。
a = [1,2,4,9,10,11,12,15,16,19,20,21]
b = a.slice_when {|i, j| i+1 != j }
p b.to_a # => [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]]
c = b.map {|a| a.length < 3 ? a : "#{a.first}-#{a.last}" }
p... -
Integer
# size -> Integer (19.0) -
整数の実装上のサイズをバイト数で返します。
...整数の実装上のサイズをバイト数で返します。
//emlist[][ruby]{
p 1.size # => 8
p 0x1_0000_0000.size # => 8
//}
@see Integer#bit_length... -
JSON
:: State # to _ h -> Hash (19.0) -
自身をハッシュに変換します。
...自身をハッシュに変換します。
//emlist[例][ruby]{
require "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,......# :max_nesting=>100,
# :depth=>0,
# :buffer_initial_length=>1024}
//}... -
JSON
:: State # to _ hash -> Hash (19.0) -
自身をハッシュに変換します。
...自身をハッシュに変換します。
//emlist[例][ruby]{
require "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,......# :max_nesting=>100,
# :depth=>0,
# :buffer_initial_length=>1024}
//}... -
Net
:: HTTPGenericRequest # body _ stream -> object (19.0) -
サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。
...t[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
post = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do |f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
post.body_stream = f
post["Content-Length"] = f.... -
Net
:: HTTPGenericRequest # body _ stream=(f) (19.0) -
サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。
...t[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
post = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do |f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
post.body_stream = f
post["Content-Length"] = f.... -
Net
:: HTTPHeader # get _ fields(key) -> [String] (19.0) -
key ヘッダフィールドの値 (文字列) を配列で返します。
...key ヘッダフィールドの値 (文字列) を配列で返します。
たとえばキー 'content-length' に対しては ['2048'] のような
文字列が得られます。一種類のヘッダフィールドが一つのヘッダの中
に複数存在することがありえます。
key は......大文字小文字を区別しません。
@param key ヘッダフィール名を文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.get_fields('accept-ranges') # => ["none"]
//}
@see Net::...