Class: Symbol

Inherits:
Object
  • Object
show all
Defined in:
lib/fancy_to_proc.rb

Instance Method Summary collapse

Instance Method Details

#&(other) ⇒ Object



16
17
18
# File 'lib/fancy_to_proc.rb', line 16

def &(other)
  proc { |*args| other.to_proc.call to_proc.call(*args) }
end

#[](*defaults) ⇒ Object



24
25
26
# File 'lib/fancy_to_proc.rb', line 24

def [](*defaults)
  call(*defaults)
end

#call(*defaults) ⇒ Object



20
21
22
# File 'lib/fancy_to_proc.rb', line 20

def call(*defaults)
  proc { |*args| args.shift.__send__(self, *defaults) }
end

#|(other) ⇒ Object



12
13
14
# File 'lib/fancy_to_proc.rb', line 12

def |(other)
  proc { |*args| args.shift.__send__(self, other) }
end

#~Object



8
9
10
# File 'lib/fancy_to_proc.rb', line 8

def ~
  method(self).to_proc
end