るりまサーチ

最速Rubyリファレンスマニュアル検索!
110件ヒット [1-100件を表示] (0.113秒)

別のキーワード

  1. time parse
  2. parser parse
  3. csv parse
  4. ripper parse
  5. psych parse_stream

ライブラリ

キーワード

検索結果

<< 1 2 > >>

URI::Generic#path -> String | nil (18166.0)

自身の path を文字列で返します。設定されていない場合は nil を返します。

...自身の path を文字列で返します。設定されていない場合は nil を返します。

require 'uri'
p URI.parse('http://example.com/hoge').path #=> "/hoge"
p URI.parse('http://example.com').path #=> ""
p URI.parse('mailto:nospam@localhost').path #=> n...
...il
p URI('ftp://example.com/foo').path #=> 'foo'
p URI('ftp://example.com/%2Ffoo').path #=> '/foo'...

Net::HTTPGenericRequest#path -> String (18130.0)

リクエストする path を文字列で返します。

...リクエストする path を文字列で返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.path # => "/index.html"
//}...

OptionParser#program_name -> String (3007.0)

プログラムの名前を文字列で返します。

...字列で返します。

デフォルトは $0 が使われます。

@return プログラムの名前を文字列で返します。

//emlist[例][ruby]{
require "optparse"

OptionParser.new do |opts|
p $0 # => /path/to/filename.rb
p opts.program_name # => filename
end
//}...

OptionParser#program_name=(name) (3007.0)

プログラムの名前を文字列で指定します。

...す。

@param name プログラムの名前を文字列で指定します。

//emlist[例][ruby]{
require "optparse"

OptionParser.new do |opts|
$0 # => /path/to/filename.rb
opts.program_name # => filename
opts.program_name = 'test' # => "test"
opts.program...

URI::HTTP#request_uri -> String (51.0)

自身の「path + '?' + query」を文字列で返します。 query が nil である場合は、自身の path を返します。

...自身の「path + '?' + query」を文字列で返します。
query が nil である場合は、自身の path を返します。

path
が空である場合には、path は「'/'」であるとします。

例:
require 'uri'
u = URI.parse("http://example.com/search?q=xxx")
p u.request_u...

絞り込み条件を変える

Net::HTTPResponse#read_body {|str| .... } -> () (31.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...onse(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}

//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.f...
...|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read_body do |s|
f.write(s)
end
end
end
end
//}

一度ブロックを与えずにこのメソッ...

Net::HTTPResponse#read_body(dest=nil) -> String|nil (31.0)

ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。

...onse(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}

//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.f...
...|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|
response.read_body do |s|
f.write(s)
end
end
end
end
//}

一度ブロックを与えずにこのメソッ...

Net::HTTPGenericRequest#body_stream -> object (19.0)

サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。

....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...

Net::HTTPGenericRequest#body_stream=(f) (19.0)

サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。

....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...

URI::Generic#select(*components) -> [String] (13.0)

指定された components に対応する構成要素を文字列の配列として返します。

...字列の配列として返します。

@param components 構成要素名をシンボルで指定します。

例:
require 'uri'

uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx')
p uri.select(:userinfo, :host, :path)
# => ["myuser:mypass", "my.example.com", "/test.rbx"]...

絞り込み条件を変える

<< 1 2 > >>