配列の変換する - Array Coercion

string = *"string"
p string #=> ["string"]

symbol = *:symbol
p symbol #=> [:symbol]

hash = *{ hash: nil }
p hash #=> [[:hash, nil]]

range = *(1..10)
p range #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

ほか array coercion

a = *"Hello"  #=> ["Hello"]
"Hello".to_a  #=> NoMethodError: undefined method `to_a' for "Hello":String
a = *(1..3)   #=> [1, 2, 3]
a = *[1,2,3]  #=> [1, 2, 3]

References

results matching ""

    No results matching ""