module Kernel

Public Instance Methods

safe_eval() click to toggle source

rubocop:disable Security/Eval

# File lib/active_object/kernel.rb, line 10
def safe_eval
  eval(self)
rescue Exception
  self
end
try_eval() click to toggle source
# File lib/active_object/kernel.rb, line 16
def try_eval
  val = SANITIZE_EVAL_REGEX.match(to_s).to_s
  return if val.nil?

  eval(val)
end

Private Instance Methods

caller_name(depth = 0) click to toggle source

rubocop:enable Security/Eval

# File lib/active_object/kernel.rb, line 26
def caller_name(depth = 0)
  val = caller[depth][CALLER_METHOD_REGEX, 1]
  return val if depth.zero? || !val.include?('<top (required)>')

  caller[depth - 1][CALLER_METHOD_REGEX, 1]
end