705件ヒット
[1-100件を表示]
(0.061秒)
種類
- インスタンスメソッド (606)
- 特異メソッド (88)
- モジュール関数 (11)
クラス
- Array (110)
- Enumerator (44)
-
File
:: Stat (11) - Hash (33)
- MatchData (99)
- Object (33)
- Range (12)
- Regexp (22)
- String (110)
- Time (99)
モジュール
- Enumerable (121)
- Kernel (11)
キーワード
- Array (11)
- [] (44)
- atime (11)
- captures (11)
- chunk (11)
-
chunk
_ while (11) - codepoints (22)
- each (44)
-
each
_ codepoint (22) -
each
_ grapheme _ cluster (14) -
each
_ line (22) - entries (6)
- gm (22)
-
grapheme
_ clusters (14) - keys (11)
- length (11)
- lines (16)
- local (22)
- match (22)
-
max
_ by (44) - mktime (22)
- permutation (22)
-
repeated
_ combination (22) -
repeated
_ permutation (22) - sample (44)
- size (11)
-
slice
_ after (22) -
slice
_ before (22) -
slice
_ when (11) - tap (11)
-
to
_ ary (11) - utc (22)
- values (11)
-
values
_ at (11)
検索結果
先頭5件
-
Object
# to _ a -> Array (18139.0) -
オブジェクトを配列に変換した結果を返します。 デフォルトでは定義されていません。
...のメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。
//emlist[][ruby]{
p( {'a'=>1}.to_a ) # [["a", 1]]
p ['array'].to_a # ["array"]
p nil.to_a # []
//}
@see Object#to_ary,Kernel.#Array... -
Time
# to _ a -> Array (18121.0) -
時刻を10要素の配列で返します。
...あるかどうか (true/false)
* zone: タイムゾーン (文字列)
//emlist[][ruby]{
t = Time.local(2000,1,2,3,4,5)
p t # => 2000-01-02 03:04:05 +0900
p t.to_a # => [5, 4, 3, 2, 1, 2000, 0, 2, false, "JST"]
//}
要素の順序は C 言語の tm 構造体に合わせています。た... -
Hash
# to _ a -> [Array] (18115.0) -
キーと値からなる 2 要素の配列を並べた配列を生成して返します。
...キーと値からなる 2 要素の配列を並べた配列を生成して返します。
//emlist[例][ruby]{
h1 = { "a" => 100, 2 => ["some"], :c => "c" }
p h1.to_a #=> c, "c"
//}
@see Hash#keys,Hash#values... -
MatchData
# to _ a -> [String] (18115.0) -
$&, $1, $2,... を格納した配列を返します。
...$&, $1, $2,... を格納した配列を返します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
//}
@see MatchData#captures... -
Range
# to _ a -> Array (15169.0) -
self を配列に変換します。
...[ruby]{
p (5..0).to_a # => []
p (0..3).to_a # => [0, 1, 2, 3]
p ('a'..'c').to_a # => ["a", "b", "c"]
p (:a..:d).to_a # => [:a, :b, :c, :d]
require 'date'
p (Date.new(1965, 4, 14) .. Date.new(1965, 4, 14)).to_a # => [#<Date: 1965-04-14 ((2438865j,0s,0n),+0s,2299161j)>]
(1..).to_a # Ra... -
Array
# repeated _ permutation(n) -> Enumerator (12227.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm......ロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}
@see Array#repeated_combination, Array#permutation... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (12227.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm......ロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}
@see Array#repeated_combination, Array#permutation... -
String
# codepoints {|codepoint| block } -> self (6218.0) -
文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)
...ch_codepoint.to_a と同じです)
//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".codepoints
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
//}
ブロックが指定された場合は String#each_codepoint と同じように動作します。
Ruby 2.6 までは deprecated......の警告が出ますが、Ruby 2.7 で警告は削除されました。
@see String#each_codepoint... -
String
# grapheme _ clusters {|grapheme _ cluster| block } -> self (6218.0) -
文字列の書記素クラスタの配列を返します。(self.each_grapheme_cluster.to_a と同じです)
...を返します。(self.each_grapheme_cluster.to_a と同じです)
//emlist[例][ruby]{
"a\u0300".grapheme_clusters # => ["à"]
//}
ブロックが指定された場合は String#each_grapheme_cluster と同じように動作します。
Ruby 2.6 までは deprecated の警告が出ますが、......Ruby 2.7 で警告は削除されました。
@see String#each_grapheme_cluster... -
String
# each _ codepoint {|codepoint| block } -> self (6214.0) -
文字列の各コードポイントに対して繰り返します。
...ます。
//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}
@see String#codepoints...