# File lib/safemode/parser.rb, line 122 def process_const(arg) sexp_type = arg.sexp_body.sexp_type # constants are encoded as: "s(:const, :Encoding)" if RUBY_VERSION >= "1.9" && sexp_type == :Encoding # handling of Encoding constants in ruby 1.9. # Note: ruby_parser evaluates __ENCODING__ to s(:colon2, s(:const, :Encoding), :UTF_8) "#{super(arg).gsub('-', '_')}" elsif sexp_type == :String # Allow String.new as used in ERB in Ruby 2.4+ to create a string buffer super(arg).to_s else raise_security_error("constant", super(arg)) end end