Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Ruby | Ruby2.0新規要素 | %iによるシンボル配列の作成

概要

%iによるシンボル配列の作成

詳細

文字列配列を作成する際は%wが便利ですが、そのシンボル版が%iです。

サンプルコード
# encoding: utf-8
require 'tbpgr_utils'

hoges = %i{hoge hige hage}
print hoges
出力
[:hoge, :hige, :hage]