207件ヒット
[1-100件を表示]
(0.048秒)
別のキーワード
種類
- インスタンスメソッド (171)
- モジュール関数 (24)
- 文書 (12)
クラス
- Enumerator (12)
-
Enumerator
:: Lazy (6) - Hash (62)
-
Prime
:: PseudoPrimeGenerator (48)
モジュール
- Enumerable (43)
- Syslog (24)
キーワード
-
each
_ with _ index (48) - filter! (14)
-
keep
_ if (24) - mask (12)
- mask= (12)
-
ruby 1
. 6 feature (12) - select! (24)
-
to
_ h (19)
検索結果
先頭5件
- Prime
:: PseudoPrimeGenerator # with _ index -> Enumerator - Prime
:: PseudoPrimeGenerator # with _ index {|prime , index| . . . } -> self - Enumerator
# with _ index(offset = 0) {|(*args) , idx| . . . } -> object - Enumerator
:: Lazy # with _ index(offset = 0) {|(*args) , idx| . . . } -> Enumerator :: Lazy - Prime
:: PseudoPrimeGenerator # each _ with _ index -> Enumerator
-
Prime
:: PseudoPrimeGenerator # with _ index -> Enumerator (21116.0) -
与えられたブロックに対して、素数を0起点の連番を渡して評価します。
...を返します。 ブロックを与えられなかった場合は Enumerator を返します。
//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}
@see Enumerator#with_index... -
Prime
:: PseudoPrimeGenerator # with _ index {|prime , index| . . . } -> self (21116.0) -
与えられたブロックに対して、素数を0起点の連番を渡して評価します。
...を返します。 ブロックを与えられなかった場合は Enumerator を返します。
//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}
@see Enumerator#with_index... -
Enumerator
# with _ index(offset = 0) {|(*args) , idx| . . . } -> object (18226.0) -
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。
..."xyz"
enum = Enumerator.new {|y| str.each_byte {|b| y << b }}
enum.with_index {|byte, idx| p [byte, idx] }
# => [120, 0]
# [121, 1]
# [122, 2]
require "stringio"
StringIO.new("foo|bar|baz").each("|").with_index(1) {|s, i| p [s, i] }
# => ["foo|", 1]
# ["bar|", 2]......にインデックスを添えてブロックを繰り返します。
インデックスは 0 から始まります。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。... -
Enumerator
:: Lazy # with _ index(offset = 0) {|(*args) , idx| . . . } -> Enumerator :: Lazy (18214.0) -
生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。
...クスは offset から始まります。
ブロックを指定した場合の戻り値は生成時に指定したレシーバ自身です。
//emlist[][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}
@see Enumerator#with_index... -
Prime
:: PseudoPrimeGenerator # each _ with _ index -> Enumerator (9116.0) -
与えられたブロックに対して、素数を0起点の連番を渡して評価します。
...を返します。 ブロックを与えられなかった場合は Enumerator を返します。
//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}
@see Enumerator#with_index... -
Prime
:: PseudoPrimeGenerator # each _ with _ index {|prime , index| . . . } -> self (9116.0) -
与えられたブロックに対して、素数を0起点の連番を渡して評価します。
...を返します。 ブロックを与えられなかった場合は Enumerator を返します。
//emlist[例][ruby]{
require 'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2, 0]
# [3, 1]
# [5, 2]
# [7, 3]
//}
@see Enumerator#with_index... -
Enumerable
# each _ with _ index(*args) -> Enumerator (6232.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...返すような
Enumerator を返します。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イテレータメソッド (each など) にそのまま渡......each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}
//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}
@see Enumerator#with_index... -
Enumerable
# each _ with _ index(*args) {|item , index| . . . } -> self (6232.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...返すような
Enumerator を返します。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イテレータメソッド (each など) にそのまま渡......each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}
//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}
@see Enumerator#with_index... -
Syslog
. # mask -> Integer | nil (3106.0) -
ログの優先度のマスクを取得または設定します。 マスクは永続的であり、 Syslog.openやSyslog.close ではリセットされません。
...であり、
Syslog.openやSyslog.close
ではリセットされません。
@param mask ログの優先度のマスクを設定します。
@raise RuntimeError syslog がオープンされていない場合、発生します。
使用例
require 'syslog'
include Syslog::Constants
# ログ......くはsyslog.conf を参照
log = '/var/log/ftp.log'
Syslog.open('ftpd', LOG_PID | LOG_NDELAY, LOG_FTP)
Syslog.mask = Syslog::LOG_UPTO(LOG_ERR)
[ LOG_CRIT, LOG_ERR, LOG_WARNING,
LOG_NOTICE, LOG_INFO, LOG_DEBUG ].each_with_index { |c, i|
Syslog.log(c, "test for syslog FTP #{c}, #{i}......")
}
Syslog.close
File.foreach(log){|line|
print line if line =~ /FTP/
}...