るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.133秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Range#entries -> Array (26114.0)

self を配列に変換します。

.....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 # RangeError: cannot convert endless range...

Range#to_a -> Array (11014.0)

self を配列に変換します。

.....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 # RangeError: cannot convert endless range...