Class: Symbol

Inherits:
Object
  • Object
show all
Defined in:
lib/expendables/symbol/compose.rb,
lib/expendables/symbol/alias_to_proc.rb,
lib/expendables/symbol/to_proc_with_args.rb

Instance Method Summary collapse

Instance Method Details

#+@Object



2
3
4
# File 'lib/expendables/symbol/to_proc_with_args.rb', line 2

def +@
  self.to_proc
end

#compose(o) ⇒ Object Also known as: >>



2
3
4
# File 'lib/expendables/symbol/compose.rb', line 2

def compose o
  -> *args { (+o).call((+self).call(*args)) }
end

#to_proc_with_args(*static_args, &static_block) ⇒ Object Also known as: to_proc



6
7
8
9
10
11
12
# File 'lib/expendables/symbol/to_proc_with_args.rb', line 6

def to_proc_with_args(*static_args, &static_block)
  Proc.new do |*proc_args, &proc_block|
    receiver = proc_args.shift
    block = (+static_block >> +proc_block)
    to_proc_without_args.call(receiver, *static_args, *proc_args, &block)
  end
end