るりまサーチ

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

別のキーワード

  1. _builtin |
  2. set |
  3. ipaddr |
  4. array |
  5. integer |

モジュール

検索結果

<< 1 2 3 > >>

Net::IMAP::Envelope#from -> [Net::IMAP::Address] | nil (18219.0)

From を Net::IMAP::Address オブジェクトの配列で返します。

...From を Net::IMAP::Address オブジェクトの配列で返します。

エンベロープに存在しないときは nil を返します。...

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) {|nodes| ...} -> () (6240.0)

node から到達可能な強連結成分についてのイテレータです。

...達可能な強連結成分についてのイテレータです。

返す値は規定されていません。

each_strongly_connected_component_from
tsort_each_node を呼びません。

@param node ノードを指定します。

//emlist[例 到達可能なノードを表示する][ruby]{
r...
...end
end

non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

non_sort.each_strongly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]...
...#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}

@see TSort.each_strongly_connected_component_from...

Addrinfo#connect_from(host, port) {|sock| ... } -> object (6216.0)

引数で指定されたアドレスから 自身のアドレスへソケットを接続します。

...ケット接続のローカル側のアドレスになります。

require 'socket'

Addrinfo.tcp("www.ruby-lang.org", 80).connect_from("0.0.0.0", 4649) {|s|
s.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n"
puts s.read
}

@param host ホスト(IP アドレスもしくはホ...

Gem::RemoteFetcher#get_proxy_from_env -> URI | nil (6203.0)

環境変数にセットされている HTTP proxy の情報を取得して返します。

環境変数にセットされている HTTP proxy の情報を取得して返します。

ここでチェックしている環境変数は以下の通りです。

* http_proxy
* http_proxy_user
* http_proxy_pass
* HTTP_PROXY
* HTTP_PROXY_USER
* HTTP_PROXY_PASS

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) -> Enumerator (6140.0)

node から到達可能な強連結成分についてのイテレータです。

...達可能な強連結成分についてのイテレータです。

返す値は規定されていません。

each_strongly_connected_component_from
tsort_each_node を呼びません。

@param node ノードを指定します。

//emlist[例 到達可能なノードを表示する][ruby]{
r...
...end
end

non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

non_sort.each_strongly_connected_component{|nodes|
p nodes
nodes.each {|node|
non_sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]...
...#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}

@see TSort.each_strongly_connected_component_from...

絞り込み条件を変える

Addrinfo#connect_from(host, port) -> Socket (6116.0)

引数で指定されたアドレスから 自身のアドレスへソケットを接続します。

...ケット接続のローカル側のアドレスになります。

require 'socket'

Addrinfo.tcp("www.ruby-lang.org", 80).connect_from("0.0.0.0", 4649) {|s|
s.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n"
puts s.read
}

@param host ホスト(IP アドレスもしくはホ...

UNIXSocket#recvfrom(maxlen, flags = 0) -> [String [String, String]] (6107.0)

recvfrom(2) を用いてソケットからメッセージを受け取ります。

...recvfrom(2) を用いてソケットからメッセージを受け取ります。

maxlen で受け取るメッセージの最大長をバイト数で指定します。

flags には Socket::MSG_* という名前の定数の bitwise OR を渡します。

戻り値は文字列と相手ソケット...
...のパスのペアです。

例:

require 'socket'

UNIXServer.open("/tmp/s") {|serv|
c = UNIXSocket.open("/tmp/s")
s = serv.accept
s.send "a", 0
p c.recvfrom(10)[0] #=> "a"
}

@param maxlen 受け取るメッセージの最大長
@param flags フラグ...

Net::SMTP#open_message_stream(from_addr, *to_addrs) {|f| .... } -> () (247.0)

メール書き込みの準備をし、書き込み先のストリームオブジェクトを ブロックに渡します。ブロック終了後、書きこんだ結果が 送られます。

...

from
_domain は送り主のメールアドレス ('...@...'のかたち) 、
to_addrs には送信先メールアドレスを文字列で渡します。

require 'net/smtp'

Net::SMTP.start('smtp.example.com', 25) {|smtp|
smtp.open_message_stream('from@example.com', 'to@example.net') {|f|...
...f.puts 'From: from@example.com'
f.puts 'To: to@example.net'
f.puts 'Subject: test mail'
f.puts
f.puts 'This is test mail.'
}
}

ready は obsolete です。

@param from_addr 送信元のメールアドレス
@param to_addrs 送信先のメールアドレス(複...

Net::SMTP#ready(from_addr, *to_addrs) {|f| .... } -> () (247.0)

メール書き込みの準備をし、書き込み先のストリームオブジェクトを ブロックに渡します。ブロック終了後、書きこんだ結果が 送られます。

...

from
_domain は送り主のメールアドレス ('...@...'のかたち) 、
to_addrs には送信先メールアドレスを文字列で渡します。

require 'net/smtp'

Net::SMTP.start('smtp.example.com', 25) {|smtp|
smtp.open_message_stream('from@example.com', 'to@example.net') {|f|...
...f.puts 'From: from@example.com'
f.puts 'To: to@example.net'
f.puts 'Subject: test mail'
f.puts
f.puts 'This is test mail.'
}
}

ready は obsolete です。

@param from_addr 送信元のメールアドレス
@param to_addrs 送信先のメールアドレス(複...

Enumerable#max_by {|item| ... } -> object | nil (152.0)

各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。

...ator: ["albatross", "dog", "horse"]:max_by>
a.max_by { |x| x.length } # => "albatross"
//}

//emlist[例][ruby]{
a = %w[albatross dog horse]
a.max_by(2) # => #<Enumerator: ["albatross", "dog", "horse"]:max_by(2)>
a.max_by(2) {|x| x.length } # => ["albatross", "horse"]
//}

//emlist...
...def wsample(n)
self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (h[x].length/30.0).to_i...

絞り込み条件を変える

<< 1 2 3 > >>