別のキーワード
種類
- インスタンスメソッド (168)
- 文書 (38)
- 特異メソッド (34)
クラス
-
Net
:: HTTP (24) -
Net
:: HTTPGenericRequest (72) -
RubyVM
:: InstructionSequence (36)
モジュール
-
CGI
:: HtmlExtension (48) -
Net
:: HTTPHeader (12) -
RubyVM
:: AbstractSyntaxTree (10)
キーワード
-
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 3
. 0 . 0 (5) - body (12)
- body= (12)
-
body
_ stream (12) -
body
_ stream= (12) -
content
_ type (12) - disasm (12)
- disassemble (12)
- form (24)
-
multipart
_ form (24) - of (10)
- patch (12)
-
request
_ body _ permitted? (12) -
response
_ body _ permitted? (12) -
ruby 1
. 8 . 3 feature (12) -
to
_ a (12) - クラス/メソッドの定義 (12)
検索結果
先頭5件
-
Net
:: HTTP # post(path , data , header = nil , dest = nil) {|body _ segment| . . . . } -> Net :: HTTPResponse (18254.0) -
サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。
...サーバ上の path にあるエンティティに対し文字列 data を
POST で送ります。
返り値は Net::HTTPResponse のインスタンスです。
ブロックと一緒に呼びだされたときはエンティティボディを少しずつ文字列として
ブロックに与え......戻り値の HTTPResponse オブジェクトは有効な body を
持ちません。
POST する場合にはヘッダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用いま......。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。
@param path POST先のパスを文字列で指定します。
@param header リクエストの HTTP ヘッダをハッシュで指定します。
@param dest 利用... -
Net
:: HTTPGenericRequest # request _ body _ permitted? -> bool (6134.0) -
リクエストにエンティティボディを一緒に送ることが許されている HTTP メソッド (POST など)の場合真を返します。
...ッド (POST など)の場合真を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
post = Net::HTTP::Post.new(uri.request_uri)
post.request_body_permitted? # => true
head = Net::HTTP::Head.new(uri.request_uri)
head.request_body_permit... -
Net
:: HTTPGenericRequest # response _ body _ permitted? -> bool (6134.0) -
サーバからのレスポンスにエンティティボディを含むことが許されている HTTP メソッド (GET, POST など)の場合真を返します。
...(GET, POST など)の場合真を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
post = Net::HTTP::Post.new(uri.request_uri)
post.response_body_permitted? # => true
head = Net::HTTP::Head.new(uri.request_uri)
head.response_body_permi... -
Net
:: HTTPGenericRequest # body _ stream -> object (6130.0) -
サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。
...//emlist[例][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.size
end
post.body_stream # => #<File:/path/to/test (closed)>
//}... -
Net
:: HTTPGenericRequest # body _ stream=(f) (6130.0) -
サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。
...//emlist[例][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.size
end
post.body_stream # => #<File:/path/to/test (closed)>
//}... -
Net
:: HTTPGenericRequest # body -> String (6118.0) -
サーバに送るリクエストのエンティティボディを返します。
...クエストのエンティティボディを返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.body = "Test Post Data"
req.body # => "Test Post Data"
//}
@see Net::HTTPGenericRequest#body=... -
Net
:: HTTPGenericRequest # body=(body) (6118.0) -
サーバに送るリクエストのエンティティボディを文字列で設定します。
...。
@param body 設定するボディを文字列で与えます。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Post.new(uri.request_uri)
req.body = "Test Post Data" # => "Test Post Data"
//}
@see Net::HTTPGenericRequest#body... -
Net
:: HTTPHeader # content _ type -> String|nil (6112.0) -
"text/html" のような Content-Type を表す 文字列を返します。
...うな Content-Type を表す
文字列を返します。
Content-Type: ヘッダフィールドが存在しない場合には nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/comments.cgi?post=comment')
req = Net::HTTP::Post.new(uri.request_u......ri)
req.content_type # => nil
req.content_type = 'multipart/form-data'
req.content_type # => "multipart/form-data"
//}... -
RubyVM
:: AbstractSyntaxTree . of(proc) -> RubyVM :: AbstractSyntaxTree :: Node (3118.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:39-2:44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))
def hello
puts "hello, world"
end
pp RubyVM::AbstractSyntaxTree.of(m......:9
# pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest: nil
# kw: nil
# kwrest: nil
# block: nil)
# body:
# (FCALL@6:2-6:21 :puts (LIST@6:7-6:21 (STR@6:7-6:21 "hello, world") n......が発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:39-2:44 (LIT@2:39-2:......o
puts "hello, world"
end
pp RubyVM::AbstractSyntaxTree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest: nil
#......kw: nil
# kwrest: nil
# block: nil)
# body:
# (FCALL@6:2-6:21 :puts (LIST@6:7-6:21 (STR@6:7-6:21 "hello, world") nil)))
//}...