Tbpgr Blog

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

Ruby | Regexp | +

概要

Regexp#+ other -> String

詳細

自信の文字列と other を連結した新しい文字列を返却

サンプルコード
require 'tbpgr_utils'

base = 'hoge'
bulk_puts_eval binding, <<-EOS
base + 'add'
base
EOS

__END__
下記はTbpgrUtils gemの機能
bulk_puts_eval

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

出力

base + 'add' # => "hogeadd"
base         # => "hoge"