Sha256: 915be212021b4fdb666cb06342ab6482ebac1eab7df39dc0185e0c9a17cec986
Contents?: true
Size: 479 Bytes
Versions: 4
Compression:
Stored size: 479 Bytes
Contents
require 'internal/node/as_expression' require 'internal/proc/signature' require 'internal/proc' class Proc # Return a single-line string representation of a proc's # definition/body, similarly to +Method#as_expression+. def as_expression sig = self.signature body_expression = self.body ? self.body.as_expression : nil s = sig.args.unspecified ? "" : sig.to_s + ' ' b = body_expression ? body_expression + ' ' : '' return "proc { #{s}#{b}}" end end
Version data entries
4 entries across 4 versions & 2 rubygems