以下の内容はhttps://tbpgr.hatenablog.com/entry/20140317/1395062343より取得しました。


ActiveSupport | Array#to_sentence

概要

Array#to_sentence

詳細

Array#to_sentence について

Array#to_sentence

リストを英文で単語を列挙する際のフォーマットにする。
詳細はサンプル参照。

サンプル

# encoding: utf-8
require 'active_support/core_ext/array/conversions'
require 'tbpgr_utils'

I18n.enforce_available_locales = true
bulk_puts_eval binding, <<-EOS
%w!hoge!.to_sentence
%w!hoge hige!.to_sentence
%w!hoge hige hage!.to_sentence
EOS

__END__
・下記はTbpgrUtils gemの機能
bulk_puts_eval

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils

出力

%w!hoge!.to_sentence # => "hoge"
%w!hoge hige!.to_sentence # => "hoge and hige"
%w!hoge hige hage!.to_sentence # => "hoge, hige, and hage"



以上の内容はhttps://tbpgr.hatenablog.com/entry/20140317/1395062343より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14