121件ヒット
[1-100件を表示]
(0.142秒)
ライブラリ
- ビルトイン (22)
-
cgi
/ core (22) - forwardable (22)
- json (22)
-
net
/ http (33)
クラス
- CGI (22)
- Hash (22)
-
JSON
:: State (22)
モジュール
- Forwardable (22)
-
Net
:: HTTPHeader (33)
検索結果
先頭5件
-
Hash
# length -> Integer (39114.0) -
ハッシュの要素の数を返します。
...ハッシュの要素の数を返します。
//emlist[][ruby]{
h = { "d" => 100, "a" => 200, "v" => 300, "e" => 400 }
h.length #=> 4
h.size #=> 4
h.delete("a") #=> 200
h.length #=> 3
h.size #=> 3
//}... -
Hash
# size -> Integer (24014.0) -
ハッシュの要素の数を返します。
...ハッシュの要素の数を返します。
//emlist[][ruby]{
h = { "d" => 100, "a" => 200, "v" => 300, "e" => 400 }
h.length #=> 4
h.size #=> 4
h.delete("a") #=> 200
h.length #=> 3
h.size #=> 3
//}... -
JSON
:: State # to _ hash -> Hash (3210.0) -
自身をハッシュに変換します。
...quire "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
:: HTTPHeader # fetch(key) {|hash| . . . . } -> String (132.0) -
key ヘッダフィールドを返します。
...key ヘッダフィールドを返します。
たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
該当するキーが登録されてい
ない時には、引数 default が与えられてい.......fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") #......=> "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # => 99
//}
@see Net::HTTPHeader#[]... -
Forwardable
# delegate(hash) -> () (127.0) -
メソッドの委譲先を設定します。
...@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。
例:
require 'forwardable'
class Zap
extend Forwardable
delegate :length => :@s......tr
delegate [:first, :last] => :@arr
def initialize
@arr = %w/foo bar baz/
@str = "world"
end
end
zap = Zap.new
zap.length # => 5
zap.first # => "foo"
zap.last # => "baz"... -
Forwardable
# instance _ delegate(hash) -> () (127.0) -
メソッドの委譲先を設定します。
...@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。
例:
require 'forwardable'
class Zap
extend Forwardable
delegate :length => :@s......tr
delegate [:first, :last] => :@arr
def initialize
@arr = %w/foo bar baz/
@str = "world"
end
end
zap = Zap.new
zap.length # => 5
zap.first # => "foo"
zap.last # => "baz"... -
JSON
:: State # to _ h -> Hash (110.0) -
自身をハッシュに変換します。
...quire "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
:: HTTPHeader # fetch(key) -> String (32.0) -
key ヘッダフィールドを返します。
...key ヘッダフィールドを返します。
たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
該当するキーが登録されてい
ない時には、引数 default が与えられてい.......fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") #......=> "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # => 99
//}
@see Net::HTTPHeader#[]... -
Net
:: HTTPHeader # fetch(key , default) -> String (32.0) -
key ヘッダフィールドを返します。
...key ヘッダフィールドを返します。
たとえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
該当するキーが登録されてい
ない時には、引数 default が与えられてい.......fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length", "default") #......=> "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # => 99
//}
@see Net::HTTPHeader#[]... -
CGI
# header(options = "text / html") -> String (31.0) -
HTTP ヘッダを options に従って生成します。 CGI#out と違い、標準出力には出力しません。 CGI#out を使わずに自力で HTML を出力したい場合などに使います。 このメソッドは文字列エンコーディングを変換しません。
...応します。
: connection
接続の種類を指定します。Connection ヘッダに対応します。
: length
送信するコンテンツの長さを指定します。Content-Length ヘッダに対応します。
: language
送信するコンテンツの言語を指定します。Content......t Found"
"METHOD_NOT_ALLOWED" --> "405 Method Not Allowed"
"NOT_ACCEPTABLE" --> "406 Not Acceptable"
"LENGTH_REQUIRED" --> "411 Length Required"
"PRECONDITION_FAILED" --> "412 Rrecondition Failed"
"SERVER_ERROR" --> "500 Internal Server Error"......Not Implemented"
"BAD_GATEWAY" --> "502 Bad Gateway"
"VARIANT_ALSO_VARIES" --> "506 Variant Also Negotiates"
@param options Hash か文字列で HTTP ヘッダを生成するための情報を指定します。
例:
header
# Content-Type: text/html...