Sha256: e730abc8ea977cb4b410cabcba72fcc51ed522db9b5cda0fbce4bb8becd9f1dd
Contents?: true
Size: 773 Bytes
Versions: 3
Compression:
Stored size: 773 Bytes
Contents
# frozen_string_literal: true if ActiveObject.configuration.autoload_kernel module Kernel SANITIZE_EVAL_REGEX ||= /\[\d*,?\d*,?\d*\]/.freeze CALLER_METHOD_REGEX ||= /`([^']*)'/.freeze # rubocop:disable Security/Eval def safe_eval eval(self) rescue Exception self end def try_eval val = SANITIZE_EVAL_REGEX.match(to_s).to_s return if val.nil? eval(val) end # rubocop:enable Security/Eval private # rubocop:disable Style/PerlBackrefs 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 # rubocop:enable Style/PerlBackrefs end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
active_object-5.8.4 | lib/active_object/kernel.rb |
active_object-5.8.3 | lib/active_object/kernel.rb |
active_object-5.8.2 | lib/active_object/kernel.rb |