Sha256: 80fdf414d7008b4bd7801591ab82bad2d2989fdca06b8791138e991f3655466d
Contents?: true
Size: 825 Bytes
Versions: 5
Compression:
Stored size: 825 Bytes
Contents
module Safemode class Jail < Blankslate def initialize(source = nil) @source = source end def to_jail self end def to_s @source.to_s end def method_missing(method, *args, &block) unless self.class.allowed?(method) raise Safemode::NoMethodError.new(method, self.class.name, @source.class.name) end # As every call to an object in the eval'ed string will be jailed by the # parser we don't need to "proactively" jail arrays and hashes. Likewise we # don't need to jail objects returned from a jail. Doing so would provide # "double" protection, but it also would break using a return value in an if # statement, passing them to a Rails helper etc. @source.send(method, *args, &block) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
safemode-1.2.0 | lib/safemode/jail.rb |
safemode-1.1.0 | lib/safemode/jail.rb |
safemode-1.0.1 | lib/safemode/jail.rb |
safemode-1.0.0 | lib/safemode/jail.rb |
safemode-0.0.2 | lib/safemode/jail.rb |