Skip to content

Instantly share code, notes, and snippets.

@kdnk
Last active April 16, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdnk/3b0a6f25fc74777299db3e92d6925634 to your computer and use it in GitHub Desktop.
Save kdnk/3b0a6f25fc74777299db3e92d6925634 to your computer and use it in GitHub Desktop.
class Symbol
  def to_proc
    Proc.new do |obj, *args|
      obj.send self, *args
    end
  end
end

ex)

:reverse.to_proc #=> Proc.new { |i| i.reverse }

気持ちとしてはこんな感じ。 (文法的には間違ってる)

@tag_names.map{&:name}
@tag_names.map{&:name.to_proc}
@tag_names.map{&proc { |tag| tag.name }}
@tag_name.map{ |tag| tag.name }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment