Module: Kernel

Defined in:
lib/active_object/kernel.rb

Instance Method Summary collapse

Instance Method Details

#safe_evalObject

rubocop:disable Lint/RescueException, Security/Eval



9
10
11
12
13
# File 'lib/active_object/kernel.rb', line 9

def safe_eval
  eval(self)
rescue Exception
  self
end

#try_evalObject



15
16
17
18
19
20
# File 'lib/active_object/kernel.rb', line 15

def try_eval
  val = SANITIZE_EVAL_REGEX.match(to_s).to_s
  return if val.nil?

  eval(val)
end