791件ヒット
[1-100件を表示]
(0.156秒)
別のキーワード
ライブラリ
クラス
- Array (21)
- CSV (12)
-
CSV
:: Row (12) - Enumerator (24)
- Matrix (196)
- Pathname (72)
- Prime (24)
-
Prime
:: PseudoPrimeGenerator (48) -
REXML
:: Attributes (24) -
REXML
:: Element (24) -
REXML
:: Elements (24) - Set (27)
- String (12)
- StringIO (100)
-
Thread
:: Queue (16) -
Thread
:: SizedQueue (36) -
WIN32OLE
_ TYPE (12)
モジュール
- Enumerable (48)
-
Net
:: HTTPHeader (12) - TSort (47)
キーワード
- bytes (14)
- collect (24)
- collect! (14)
-
default
_ event _ sources (12) - deq (12)
- difference (9)
-
each
_ attribute (12) -
each
_ byte (24) -
each
_ capitalized _ name (12) -
each
_ child (24) -
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) -
each
_ entry (12) -
each
_ filename (12) -
each
_ line (48) -
each
_ strongly _ connected _ component (12) -
each
_ strongly _ connected _ component _ from (23) -
each
_ with _ index (72) - entries (12)
-
find
_ index (36) - index (36)
- intersection (9)
- length (2)
- lines (14)
- map (24)
- map! (14)
- pack (21)
- pop (12)
- shift (24)
- size (2)
-
to
_ a (24) -
tsort
_ each (12) - union (9)
- unpack (12)
-
with
_ index (48)
検索結果
先頭5件
- Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) -> Enumerator - Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) {|prime| . . . } -> object - Matrix
# each(which = :all) -> Enumerator - Matrix
# each(which = :all) {|e| . . . } -> self - StringIO
# each(rs = $ / ) {|line| . . . } -> self
-
Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) -> Enumerator (21317.0) -
全ての素数を順番に与えられたブロックに渡して評価します。
...ブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のインスタンスを指定します。
@return......す。
//emlist[例][ruby]{
require 'prime'
Prime.each(6){|prime| prime } # => 5
Prime.each(7){|prime| prime } # => 7
Prime.each(10){|prime| prime } # => 7
Prime.each(11){|prime| prime } # => 11
//}
//emlist[例: 30以下の双子素数][ruby]{
require 'prime'
Prime.each(30).each_cons(2).select{......Rubyらしいプログラミングを提供することが責務です。独自に素数性の保障するのはメソッドの責務ではありません。従って、次のように精度の低い素数生成器を与えると、真に素数とは限らない数列が発生します。
//emlist[... -
Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) {|prime| . . . } -> object (21317.0) -
全ての素数を順番に与えられたブロックに渡して評価します。
...ブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のインスタンスを指定します。
@return......す。
//emlist[例][ruby]{
require 'prime'
Prime.each(6){|prime| prime } # => 5
Prime.each(7){|prime| prime } # => 7
Prime.each(10){|prime| prime } # => 7
Prime.each(11){|prime| prime } # => 11
//}
//emlist[例: 30以下の双子素数][ruby]{
require 'prime'
Prime.each(30).each_cons(2).select{......Rubyらしいプログラミングを提供することが責務です。独自に素数性の保障するのはメソッドの責務ではありません。従って、次のように精度の低い素数生成器を与えると、真に素数とは限らない数列が発生します。
//emlist[... -
Matrix
# each(which = :all) -> Enumerator (21239.0) -
行列の各要素を引数としてブロックを呼び出します。
...、…という順番で処理します。
which に以下の Symbol を指定することで
引数として使われる要素を限定することができます。
* :all - すべての要素(デフォルト)
* :diagonal - 対角要素
* :off_diagonal 対角要素以外
* :lower 対角成......* :strict_lower 対角成分の下側
* :strict_upper 対角成分の上側
ブロックを省略した場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each { |e| puts e }
# => prints the numbers 1 to 4
Matrix[ [1,2], [3,4] ].each(:strict_lowe......r).to_a # => [3]
//}
@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each_with_index, Matrix#map... -
Matrix
# each(which = :all) {|e| . . . } -> self (21239.0) -
行列の各要素を引数としてブロックを呼び出します。
...、…という順番で処理します。
which に以下の Symbol を指定することで
引数として使われる要素を限定することができます。
* :all - すべての要素(デフォルト)
* :diagonal - 対角要素
* :off_diagonal 対角要素以外
* :lower 対角成......* :strict_lower 対角成分の下側
* :strict_upper 対角成分の上側
ブロックを省略した場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each { |e| puts e }
# => prints the numbers 1 to 4
Matrix[ [1,2], [3,4] ].each(:strict_lowe......r).to_a # => [3]
//}
@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each_with_index, Matrix#map... -
StringIO
# each(rs = $ / ) {|line| . . . } -> self (21235.0) -
自身から 1 行ずつ読み込み、それを引数として与えられたブロックを実行します。
...nil を指定すると行区切りなしとみなします。空文字列 "" を指定すると連続する改行を行の区切りとみなします(パラグラフモード)。
@raise IOError 自身が読み取り不可なら発生します。
//emlist[例][ruby]{
require "stringio"
a = StringIO.......new("hoge\nfoo\n")
a.each{|l| p l }
#=> "hoge\n"
# "foo\n"
//}
@see $/
@see IO#each_line... -
StringIO
# each(rs = $ / ) -> Enumerator (21135.0) -
自身から 1 行ずつ読み込み、それを引数として与えられたブロックを実行します。
...nil を指定すると行区切りなしとみなします。空文字列 "" を指定すると連続する改行を行の区切りとみなします(パラグラフモード)。
@raise IOError 自身が読み取り不可なら発生します。
//emlist[例][ruby]{
require "stringio"
a = StringIO.......new("hoge\nfoo\n")
a.each{|l| p l }
#=> "hoge\n"
# "foo\n"
//}
@see $/
@see IO#each_line... -
REXML
:: Attributes # each {|name , value| . . . } -> () (21126.0) -
各属性の名前と値に対しブロックを呼び出します。
...ます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.each do |name, value|... -
REXML
:: Elements # each(xpath = nil) {|element| . . . } -> [REXML :: Elements] (18256.0) -
全ての子要素に対しブロックを呼び出します。
...クを呼び出します。
REXML::XPath.each などとは異なり、要素以外の
テキストノードなどはすべて無視されることに注意してください。
@param xpath XPath文字列
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '......ロックに渡される
doc.root.elements.each {|e|p e}
# <b/>, <b/> がブロックに渡される
doc.root.elements.each('b') {|e|p e} #-> Yields b, b elements
# <b/>,<c/>,<d/>,<b/>,<c/>,<d/> がブロックに渡される
doc.root.elements.each('child::node()') {|e|p e}
# <b/>,<c/>,<d/>,"sean"......,<b/>,<c/>,<d/> がブロックに渡される
REXML::XPath.each(doc.root, 'child::node()'){|node| p node }
//}... -
CSV
# each {|row| . . . } -> nil (18250.0) -
各行に対してブロックを評価します。
...//emlist[例 CSV.new 時に :header => true を指定した場合][ruby]{
require "csv"
users = <<CSV
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.new(users, headers: true)
csv.each do |row|
p row
end
# => #<CSV::Row "id":"1" "first n......ow "id":"2" "first name":"jiro" "last name":"suzuki" "age":"18">
# => #<CSV::Row "id":"3" "first name":"ami" "last name":"sato" "age":"19">
# => #<CSV::Row "id":"4" "first name":"yumi" "last name":"adachi" "age":"21">
//}
//emlist[例 CSV.new 時に :header => true を指定しない場合][ruby]{......require "csv"
users = <<CSV
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.new(users)
csv.each do |row|
p row
end
# => ["id", "first name", "last name", "age"]
# => ["1", "taro", "tanaka", "20"]
# => ["2", "jiro", "suzuki", "18"]
# => [...