From: "mame (Yusuke Endoh)" Date: 2012-11-20T20:57:23+09:00 Subject: [ruby-dev:46553] [ruby-trunk - Feature #5554][Rejected] A method that applies self to a Proc if self is a Symbol Issue #5554 has been updated by mame (Yusuke Endoh). Status changed from Feedback to Rejected 長期間フィードバックがない+望み薄と思われるので閉じます。 -- Yusuke Endoh ---------------------------------------- Feature #5554: A method that applies self to a Proc if self is a Symbol https://bugs.ruby-lang.org/issues/5554#change-33200 Author: sawa (Tsuyoshi Sawada) Status: Rejected Priority: Normal Assignee: Category: Target version: Often, you want to apply a Proc to self if self is a Symbol, but not do anything if otherwise. In this case, something I call Object#desymbolize may be convenient: proc = ->sym{ case sym when :small_icon then "16pt" when :medium_icon then "32pt" when :large_icon then "64pt" end } :small_icon.desymbolize(&proc) => "16pt" "18pt".desymbolize(&proc) => "18pt" An implementation may be as follows: class Object def desymbolize; self end end class Symbol def desymbolize ≺ pr.call(self) end end -- http://bugs.ruby-lang.org/