Sha256: dcfbb38d8dc98c9c94923f1e1f0eca917a319388d46e586f1e0f59b017351640

Contents?: true

Size: 484 Bytes

Versions: 2

Compression:

Stored size: 484 Bytes

Contents

require 'internal/proc'

require 'decompiler/node/as_expression'
require 'decompiler/proc/signature'

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

2 entries across 2 versions & 1 rubygems

Version Path
ruby-decompiler-0.0.3 lib/decompiler/proc/as_expression.rb
ruby-decompiler-0.0.2 lib/decompiler/proc/as_expression.rb