# encoding: utf-8 require 'facets/kernel/try' #------------------------------------------------------------------------------- # try: 後ろに続くメソッドを、通常通りに呼び出すが # nilに対して存在しないメソッドを呼び出した場合でもエラーにならない(nilを返す) # # 主に「nilかもしれない変数」に対して、なにかのメソッドを呼び出したいときに使う options = {:output_path => ' /var/gems/1.9.1/ '} @stripped_path = options[:output_path].try.strip p @stripped_path # => "/var/gems/1.9.1/" options = {} @s