293件ヒット
[1-100件を表示]
(0.132秒)
ライブラリ
- ビルトイン (237)
-
cgi
/ core (22) - csv (22)
- prettyprint (1)
- psych (11)
クラス
- Array (66)
-
CSV
:: Row (22) -
Enumerator
:: Lazy (82) - PrettyPrint (1)
-
Psych
:: Handler (11) -
RubyVM
:: AbstractSyntaxTree :: Node (12) -
RubyVM
:: InstructionSequence (11)
モジュール
-
CGI
:: QueryExtension :: Value (22) - Enumerable (66)
検索結果
先頭5件
-
CGI
:: QueryExtension :: Value # first -> self (24202.0) -
@todo
@todo -
Enumerable
# first(n) -> Array (21227.0) -
Enumerable オブジェクトの最初の要素、もしくは最初の n 要素を返します。
...Enumerable オブジェクトの最初の要素、もしくは最初の n 要素を返します。
Enumerable オブジェクトが空の場合、引数を指定しない形式では nil を返します。
引数を指定する形式では、空の配列を返します。
@param n 取得する要......素数。
//emlist[例][ruby]{
e = "abcd".each_byte
e.first #=> 97
e.first(2) #=> [97,98]
e = "".each_byte
e.first #=> nil
e.first(2) #=> []
//}... -
Array
# first -> object | nil (21220.0) -
配列の先頭の要素を返します。要素がなければ nil を返します。
...配列の先頭の要素を返します。要素がなければ nil を返します。
//emlist[例][ruby]{
p [0, 1, 2].first #=> 0
p [].first #=> nil
//}
@see Array#last... -
RubyVM
:: InstructionSequence # first _ lineno -> Integer (15214.0) -
self が表す命令シーケンスの 1 行目の行番号を返します。
...self が表す命令シーケンスの 1 行目の行番号を返します。
例1:irb で実行した場合
RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1
例2:
# /tmp/method.rb
require "foo-library"
def foo
p :foo
end
RubyVM::InstructionSequence.of(m......ethod(:foo)).first_lineno
# => 2... -
RubyVM
:: AbstractSyntaxTree :: Node # first _ column -> Integer (15208.0) -
ソースコード中で、self を表すテキストが最初に現れる列番号を返します。
...ソースコード中で、self を表すテキストが最初に現れる列番号を返します。
列番号は0-originで、バイト単位で表されます。
//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 2')
p node.first_column # => 0
//}... -
RubyVM
:: AbstractSyntaxTree :: Node # first _ lineno -> Integer (15208.0) -
ソースコード中で、self を表すテキストが最初に現れる行番号を返します。
...ソースコード中で、self を表すテキストが最初に現れる行番号を返します。
行番号は1-originです。
//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 2')
p node.first_lineno # => 1
//}... -
Enumerable
# lazy -> Enumerator :: Lazy (12437.0) -
自身を lazy な Enumerator に変換したものを返します。
...身を lazy な Enumerator に変換したものを返します。
この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* select/find_all
* reje......ct
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみlazy)
以下はピタゴラス数 (a**2 + b**2 = c**2 を満たす自然数 a, b, c の組)......//emlist[例][ruby]{
def pythagorean_triples
(1..Float::INFINITY).lazy.flat_map {|z|
(1..z).flat_map {|x|
(x..z).select {|y|
x**2 + y**2 == z**2
}.map {|y|
[x, y, z]
}
}
}
end
# 最初の10個のピタゴラス数を表示する
p pythagorean_triples.ta... -
CGI
:: QueryExtension :: Value # last -> self (12102.0) -
@todo
@todo -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (9219.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
...ble#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cy......cle>)>:take_while>
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}
@see Enumerable#take_while... -
Enumerator
:: Lazy # take _ while {|item| . . . } -> Enumerator :: Lazy (9219.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
...ble#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cy......cle>)>:take_while>
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}
@see Enumerable#take_while...