るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

OptionParser#accept(klass, pat = /.*/) {|str| ...} -> () (27342.0)

OptionParser.accept と同様ですが、 登録したブロックはレシーバーに限定されます。

...ptionParser.accept と同様ですが、
登録したブロックはレシーバーに限定されます。

@param klass クラスオブジェクトを与えます。

@param pat match メソッドを持ったオブジェクト(Regexp オブジェクトなど)を与えます。

//emlist[例][ruby]...
...{
r
equire "optparse"
r
equire "time"

opts = OptionParser.new
opts.accept(Time) do |s,|
begin
T
ime.parse(s) if s
r
escue
r
aise OptionParser::InvalidArgument, s
end
end

opts.on("-t", "--time [TIME]", Time) do |time|
p time.class # => Time
end

opts.parse!(ARGV)
//}...

Module#ruby2_keywords(method_name, ...) -> nil (18479.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept
an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments...
...argument is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through th...
...ethod to
other methods.

T
his should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

T
his method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby...

BasicSocket#remote_address -> Addrinfo (18319.0)

getpeername(2) で得られたリモートアドレス情報を Addrinfo オブジェクトとして返します。

...getpeername(2) で得られたリモートアドレス情報を
Addrinfo オブジェクトとして返します。

返されたオブジェクトの Addrinfo#protocol は 0 を
返すことに注意してください。

r
equire 'socket'

T
CPSocket.open("www.ruby-lang.org", 80) {|s|
p s.re...
...mote_address #=> #<Addrinfo: 221.186.184.68:80 TCP>
}

T
CPServer.open("127.0.0.1", 1728) {|serv|
c = TCPSocket.new("127.0.0.1", 1728)
s = serv.accept
p s.remote_address #=> #<Addrinfo: 127.0.0.1:36504 TCP>
}

@see BasicSocket#getpeername...

OptionParser#reject(klass) -> () (12241.0)

OptionParser#accept で登録したクラスとブロックを 自身から削除します。

...ptionParser#accept で登録したクラスとブロックを
自身から削除します。

@param klass 自身から削除したいクラスを指定します。

//emlist[例][ruby]{
r
equire "optparse"
r
equire "time"

def parse(option_parser)
option_parser.on("-t", "--time [TIME]", Time) do |t...
...p time.class
end
option_parser.parse(ARGV)
end

opts = OptionParser.new
opts.accept(Time) do |s,|
begin
T
ime.parse(s) if s
r
escue
r
aise OptionParser::InvalidArgument, s
end
end

parse(opts) # => Time
opts.reject(Time)
parse(opts) # => unsupported argument type: Time (ArgumentError)...

Net::HTTP#request_get(path, header = nil) {|response| .... } -> Net::HTTPResponse (9419.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...サーバ上の path にあるエンティティを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...続を維持した状態で Net::HTTPResponse
オブジェクトをブロックに渡します。
大きなサイズのボディを一度に読みだすとまずく、
小さなサイズに分けて取りだしたい場合にはこれを利用します。

@param path 取得するエンティティ...
...aram header リクエストの HTTP ヘッダをハッシュで指定します。

//emlist[例][ruby]{
# example
r
esponse = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p re...

絞り込み条件を変える

Net::HTTP#request_head(path, header = nil) {|response| .... } -> Net::HTTPResponse (9419.0)

サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse オブジェクトを返します。

...ーバ上の path にあるエンティティのヘッダのみを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ......
...とともに呼び出されたときは、
Net::HTTP#request_get と同じ動作を
しますが、そもそもヘッダしか要求していないので
body は空です。そのためこの動作はそれほど意味はありません。

@param path ヘッダを取得するエンティティの...
...文字列で指定します。
@param header リクエストの HTTP ヘッダをハッシュで指定します。


head2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
r
esponse = http.request_head('/index.html')
p response['content-type']
//}

@see Net::HTTP#head...

Net::HTTP#request_post(path, data, header = nil) {|response| .... } -> Net::HTTPResponse (9419.0)

サーバ上の path にあるエンティティに対し文字列 data を POST で送ります。 返り値は Net::HTTPResponse のインスタンスです。

...の path にあるエンティティに対し文字列 data を
POST で送ります。
返り値は Net::HTTPResponse のインスタンスです。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '...
...et::HTTPResponse
オブジェクトをブロックに渡します。

POST する場合にはヘッダに Content-Type: を指定する必要があります。
もし header に指定しなかったならば、 Content-Type として
"application/x-www-form-urlencoded" を用います。

@param pat...
...T先のエンティティのパスを文字列で指定します。
@param data POSTするデータを与えます。
@param header リクエストの HTTP ヘッダをハッシュで指定します。

post2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
r
esponse = htt...

Net::HTTP#request_get(path, header = nil) -> Net::HTTPResponse (9319.0)

サーバ上の path にあるエンティティを取得します。 Net::HTTPResponse オブジェクトを返します。

...サーバ上の path にあるエンティティを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ... } という...
...続を維持した状態で Net::HTTPResponse
オブジェクトをブロックに渡します。
大きなサイズのボディを一度に読みだすとまずく、
小さなサイズに分けて取りだしたい場合にはこれを利用します。

@param path 取得するエンティティ...
...aram header リクエストの HTTP ヘッダをハッシュで指定します。

//emlist[例][ruby]{
# example
r
esponse = http.request_get('/index.html')
p response['content-type']
puts response.body # body is already read

# using block
http.request_get('/index.html') {|response|
p re...

Net::HTTP#request_head(path, header = nil) -> Net::HTTPResponse (9319.0)

サーバ上の path にあるエンティティのヘッダのみを取得します。 Net::HTTPResponse オブジェクトを返します。

...ーバ上の path にあるエンティティのヘッダのみを取得します。
Net::HTTPResponse オブジェクトを返します。

header が nil
でなければ、リクエストを送るときにその内容を HTTP ヘッダとして
送ります。 header は { 'Accept' = > '*/*', ......
...とともに呼び出されたときは、
Net::HTTP#request_get と同じ動作を
しますが、そもそもヘッダしか要求していないので
body は空です。そのためこの動作はそれほど意味はありません。

@param path ヘッダを取得するエンティティの...
...文字列で指定します。
@param header リクエストの HTTP ヘッダをハッシュで指定します。


head2 は時代遅れなので使わないでください。

//emlist[例][ruby]{
r
esponse = http.request_head('/index.html')
p response['content-type']
//}

@see Net::HTTP#head...
<< 1 2 3 ... > >>