るりまサーチ

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

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. t61string new
  4. matrix t
  5. fiddle type_size_t

ライブラリ

キーワード

検索結果

Range#to_json(*args) -> String (6120.0)

自身を JSON 形式の文字列に変換して返します。

...nerator::GeneratorMethods::Hash#to_json を呼び出しています。

@
param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

//emlist[例][ruby]{
require
"json/add/core"

(1..5).to_json # => "{\"json_class\":\"Range\",\"a\":[1,5,false]}"
//}

@
see...
...JSON::Generator::GeneratorMethods::Hash#to_json...

Range#entries -> Array (6114.0)

self を配列に変換します。

...

@
raise RangeError 終端のない Range オブジェクトを変換しようとしたときに発生します。

//emlist[例][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 # RangeError: cannot convert endless range to an array
//}...

Range#to_a -> Array (6114.0)

self を配列に変換します。

...

@
raise RangeError 終端のない Range オブジェクトを変換しようとしたときに発生します。

//emlist[例][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 # RangeError: cannot convert endless range to an array
//}...