1222件ヒット
[1-100件を表示]
(0.110秒)
別のキーワード
クラス
- Array (57)
- Enumerator (60)
-
Enumerator
:: Lazy (82) -
Enumerator
:: Yielder (24) - Hash (98)
- IO (24)
- Module (12)
- Object (60)
- PP (12)
- Prime (24)
-
REXML
:: Attributes (24) -
REXML
:: Element (24) -
REXML
:: Elements (24) - String (148)
- StringIO (38)
- Struct (12)
- Thread (12)
-
Thread
:: Queue (12) -
Thread
:: SizedQueue (36) - WIN32OLE (12)
-
WIN32OLE
_ EVENT (12) -
WIN32OLE
_ TYPE (12)
モジュール
- Enumerable (403)
キーワード
- << (12)
- [] (12)
- bytes (38)
- chars (12)
-
chunk
_ while (12) - codepoints (12)
-
collect
_ concat (12) - count (36)
-
default
_ event _ sources (12) - deq (12)
-
each
_ attribute (12) -
each
_ byte (72) -
each
_ char (12) -
each
_ codepoint (12) -
each
_ cons (12) -
each
_ element _ with _ attribute (12) -
each
_ element _ with _ text (12) -
each
_ grapheme _ cluster (8) -
each
_ pair (36) -
each
_ slice (24) -
each
_ with _ index (24) -
each
_ with _ object (24) - entries (12)
-
enum
_ for (24) - feed (12)
- filter! (14)
- first (24)
-
flat
_ map (12) -
grapheme
_ clusters (8) - handler= (12)
- inject (36)
-
instance
_ method (12) - invert (12)
-
keep
_ if (24) -
ole
_ query _ interface (12) - pack (21)
- pop (12)
- reduce (36)
-
respond
_ to? (12) -
reverse
_ each (12) - select! (24)
- seplist (12)
- shift (24)
-
slice
_ after (35) -
slice
_ before (60) -
slice
_ when (23) - sum (36)
-
take
_ while (24) -
to
_ a (24) -
to
_ enum (24) -
to
_ h (19) - unpack (12)
- upto (12)
-
with
_ index (24) -
with
_ object (24) - yield (12)
- zip (48)
検索結果
先頭5件
- REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () - REXML
:: Attributes # each {|name , value| . . . } -> () - Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) -> Enumerator - Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) {|prime| . . . } -> object - Enumerable
# each _ with _ object(obj) {|(*args) , memo _ obj| . . . } -> object
-
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (24520.0) -
各属性に対しブロックを呼び出します。
...ttribute オブジェクトで渡されます。
//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").firs......t
a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}... -
REXML
:: Attributes # each {|name , value| . . . } -> () (24120.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|......p [name, value]
end
# => ["foo:att", "1"]
# => ["bar:att", "2"]
# => ["att", "<"]
//}... -
Prime
# each(upper _ bound = nil , generator = EratosthenesGenerator . new) -> Enumerator (21399.0) -
全ての素数を順番に与えられたブロックに渡して評価します。
...全ての素数を順番に与えられたブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のイン......す。
//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 (21399.0) -
全ての素数を順番に与えられたブロックに渡して評価します。
...全ての素数を順番に与えられたブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@param generator 素数生成器のイン......す。
//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[... -
Enumerable
# each _ with _ object(obj) {|(*args) , memo _ obj| . . . } -> object (18633.0) -
与えられた任意のオブジェクトと要素をブロックに渡し繰り返し、最初に与えられたオブジェクトを返します。
...返します。
ブロックを省略した場合は Enumerator を返します。
@param obj 任意のオブジェクトを指定します。
//emlist[例][ruby]{
evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}
@see Enumerator#with_object... -
Enumerable
# each _ with _ object(obj) -> Enumerator (18433.0) -
与えられた任意のオブジェクトと要素をブロックに渡し繰り返し、最初に与えられたオブジェクトを返します。
...返します。
ブロックを省略した場合は Enumerator を返します。
@param obj 任意のオブジェクトを指定します。
//emlist[例][ruby]{
evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}
@see Enumerator#with_object... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (18362.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...ist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new("<a><b id='1'/><c id='2'/><d id='1'/><e/></a>")
doc.root.each_element_with_attribute('id'){|e| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }
# >> <b id='1'/>
# >> <d i......d='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1', 0, 'd'){|e| p e }
# >> <d id='1'/>
//}... -
REXML
:: Elements # each(xpath = nil) {|element| . . . } -> [REXML :: Elements] (18322.0) -
全ての子要素に対しブロックを呼び出します。
....each などとは異なり、要素以外の
テキストノードなどはすべて無視されることに注意してください。
@param xpath XPath文字列
//emlist[][ruby]{
require 'rexml/document'
require 'rexml/xpath'
doc = REXML::Document.new '<a><b/><c/><d/>sean<b/><c/><d/></a>'
# <b......>,<c/>,<d/>,<b/>,<c/>, <d/> がブロックに渡される
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 }
//}... -
String
# each _ codepoint {|codepoint| block } -> self (15427.0) -
文字列の各コードポイントに対して繰り返します。
...に対して繰り返します。
UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE) 以外のエンコーディングに対しては
各文字のバイナリ表現由来の値になります。
//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12......540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}
@see String#codepoints...