Class ActsAsWrappedClass::WrapperFinder
In: lib/acts_as_wrapped_class.rb
Parent: Object

Methods

Constants

SANDBOX_BASE_IMPORTS = ["Object", "Module", "Class", "Kernel", "Main", "Array", "Bignum", "Binding", "Comparable", "Cont", "Data", "Dir", "Enumerable", "Exception", "FalseClass", "FConst", "File", "FileTest", "Fixnum", "Float", "GC", "Hash", "Integer", "IO", "Marshal", "Math", "Match", "Method", "NilClass", "Numeric", "ObSpace", "Precision", "Proc", "Process", "ProcStatus", "ProcUID", "ProcGID", "ProcID_Syscall", "Range", "Regexp", "Stat", "String", "Struct", "Symbol", "Thread", "ThGroup", "Time", "Tms", "TrueClass", "UnboundMethod", "StandardError", "SystemExit", "Interrupt", "Signal", "Fatal", "ArgError", "EOFError", "IndexError", "RangeError", "RegexpError", "IOError", "RuntimeError", "SecurityError", "SystemCallError", "SysStackError", "ThreadError", "TypeError", "ZeroDivError", "NotImpError", "NoMemError", "NoMethodError", "FloatDomainError", "ScriptError", "NameError", "NameErrorMesg", "SyntaxError", "LoadError", "LocalJumpError", "Errno", "BoxedClass"]

Public Class methods

Add a special handler for how to wrap certain types of classes. For example, if you wanted to wrap Arrays by wrapping each of their elements

Returns a wrapper for an instance of an object, if one exsits, or the original object if it‘s a core datatype.

  • This will first attempt to find a special handler for the type of object being wrapped and invoke it‘s block
  • Then it will look for a wrapper classes that fits the object‘s type (Something looks for SomethingWrapper)
  • Finally, it checks a list of "safe" classes that don‘t need wrapping

If no match is found, an exception is raised

[Validate]