Sha256: 2f9b783de8a80da1ea37bf48adf65c48966689368ebd8b3428f14cdd0fb3b379

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

# encoding: utf-8

# Kernel
module Kernel
  # Print code + eval result
  #
  #  print_eval 8/4, binding  # => 8/4 # => 2
  #  message = 'msg';print_eval "hoge-#{message}", binding # => "hoge-#{message}" # => "hoge-msg"
  def print_eval(code, binding)
    print exec_eval code, binding
  end

  # Puts code + eval result
  #
  #  puts_eval 8/4, binding  # => 8/4 # => 2\n
  #  message = 'msg';puts_eval "hoge-#{message}", binding # => "hoge-#{message}" # => "hoge-msg"\n
  def puts_eval(code, binding)
    puts exec_eval code, binding
  end

  def exec_eval(code, binding)
    ret = eval code, binding
    "#{code} # => #{ret.inspect}"
  end
  private :exec_eval
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.7 lib/open_classes/kernel.rb