Module: ToProc

Defined in:
lib/to_proc.rb,
lib/to_proc/try.rb,
lib/to_proc/two.rb

Constant Summary collapse

Try =
-> process do
  -> input do
    begin
      output = process[input]
      output.nil? ? input : output
    rescue
      input
    end
  end
end
Two =
-> method do
  -> receiver, argument { receiver.send method, argument }
end

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/to_proc.rb', line 2

def self.[] name
  Module.new do
    define_method :to_proc do
      method(name).to_proc
    end
  end
end