4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/finitio/support/proc_with_code.rb', line 4
def self.new(*args, &bl)
return Proc.new(*args, &bl) unless args.size == 2 && bl.nil?
p = Kernel.eval("->(#{args.first}){ #{args.last} }")
p.instance_variable_set(:@_finitio_src, args)
def p.finitio_src
@_finitio_src
end
def p.hash
@_finitio_src.hash
end
def p.==(other)
super || (
other.is_a?(Proc) &&
other.respond_to?(:finitio_src) &&
other.finitio_src == self.finitio_src
)
end
def p.eql?(other)
self.==(other)
end
p
end
|