るりまサーチ

最速Rubyリファレンスマニュアル検索!
354件ヒット [1-100件を表示] (0.084秒)
トップページ > クエリ:p[x] > クエリ:sum[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. rsa p
  5. dh p=

検索結果

<< 1 2 3 ... > >>

Array#sum(init=0) {|e| expr } -> object (18290.0)

要素の合計を返します。例えば [e1, e2, e3].sum は init + e1 + e2 + e3 を返します。

...[e1, e2, e3].sum は init + e1 + e2 + e3 を返します。

ブロックが与えられた場合、加算する前に各要素にブロックが適用されます。

配列が空の場合、initを返します。

//emlist[例][ruby]{
[].sum #=> 0
[].sum(0.0)...
...0.0
[1, 2, 3].sum #=> 6
[3, 5.5].sum #=> 8.5
[2.5, 3.0].sum(0.0) {|e| e * e } #=> 15.25
[Object.new].sum #=> TypeError
//}

配列の平均値は以下のように求められます。

//emlist[例][ruby]{
mean = ary.sum(0.0) / ary.len...
...使えます。

//emlist[例][ruby]{
["a", "b", "c"].sum("") #=> "abc"
[[1], [[2]], [3]].sum([]) #=> [1, [2], 3]
//}

しかし、文字列の配列や配列の配列の場合 Array#join や Array#flatten の方が Array#sum よりも高速です。

//emlist[例][ruby]{
["a", "...

Enumerable#sum(init=0) {|e| expr } -> object (18256.0)

要素の合計を返します。

...返します。

//emlist[例][ruby]{
{ 1 => 10, 2 => 20 }.sum {|k, v| k * v } # => 50
(1..10).sum # => 55
(1..10).sum {|v| v * 2 } # => 110
('a'..'z').sum # => TypeError
//}

init 引数を明示的に指名すると数値...
...list[例][ruby]{
{ 1 => 10, 2 => 20 }.sum([]) #=> [1, 10, 2, 20]
"a\nb\nc".each_line.lazy.map(&:chomp).sum("") #=> "abc"
[[1], [[2]], [3]].sum([]) #=> [1, [2], 3]
//}

"+" メソッドが再定義されている場合、Enumerable#sum は再定義を無視することが...
...あります(例えばInteger#+)。

@see Array#sum...

Gem::Package::TarHeader#update_checksum (12200.0)

チェックサムを更新します。

チェックサムを更新します。

OpenSSL::SSL::OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION -> Integer (12200.0)

セッション再ネゴシエーションをした場合にサーバ側で 常に新しいセッションを生成するフラグです。

...セッション再ネゴシエーションをした場合にサーバ側で
常に新しいセッションを生成するフラグです。

OpenSSL::SSL::SSLContext#options= で利用します。...

PStore::EMPTY_MARSHAL_CHECKSUM -> String (12200.0)

内部で利用する定数です。

内部で利用する定数です。

絞り込み条件を変える

Socket::Constants::IPV6_CHECKSUM -> Integer (12200.0)

Byte offset into a packet where the checksum is located. BasicSocket#getsockopt, BasicSocket#setsockopt の第2引数(optname)に使用します。

...Byte offset into a packet where the checksum is located.
BasicSocket#getsockopt, BasicSocket#setsockopt
の第2引数(optname)に使用します。

@see Socket::Constants::IPPROTO_IPV6,
ip6(4freebsd),
3542...

Socket::IPV6_CHECKSUM -> Integer (12200.0)

Byte offset into a packet where the checksum is located. BasicSocket#getsockopt, BasicSocket#setsockopt の第2引数(optname)に使用します。

...Byte offset into a packet where the checksum is located.
BasicSocket#getsockopt, BasicSocket#setsockopt
の第2引数(optname)に使用します。

@see Socket::Constants::IPPROTO_IPV6,
ip6(4freebsd),
3542...

OptionParser#summarize(to = [], width = self.summary_width, max = width - 1, indent= self.summary_indent) -> () (9300.0)

サマリを指定された to へと加えていきます。

...ません。

@param to サマリを出力するオブジェクトを指定します。to には << メソッドが定義されいる必要があります。

@param width サマリの幅を整数で指定します。

@param max サマリの最大幅を整数で指定します。

@param indent サ...
...equire "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end

opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10, 8, " ")
# => ["description\n",...
..." -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}...

OptionParser#summarize(to = [], width = self.summary_width, max = width - 1, indent= self.summary_indent) {|line| ... } -> () (9300.0)

サマリを指定された to へと加えていきます。

...ません。

@param to サマリを出力するオブジェクトを指定します。to には << メソッドが定義されいる必要があります。

@param width サマリの幅を整数で指定します。

@param max サマリの最大幅を整数で指定します。

@param indent サ...
...equire "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end

opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10, 8, " ")
# => ["description\n",...
..." -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}...
<< 1 2 3 ... > >>