Sha256: db50db0f336e6d157a3bf3d5f3fa7890f6d9b87e4d8fa0d79e595a87c53aba22
Contents?: true
Size: 593 Bytes
Versions: 1
Compression:
Stored size: 593 Bytes
Contents
require 'to_proc' module ToProc module Refine module Array refine ::Array do def to_proc if size == 2 case when self[0].is_a?(Symbol) method, argument = self return -> receiver { receiver.send method, argument } when self[1].is_a?(Symbol) receiver, method = self return -> argument { receiver.send method, argument } end end arguments = self -> receiver { receiver.to_proc[*arguments] } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
to_proc-0.0.8 | lib/to_proc/refine/array.rb |