Module: ActsAsRunnableCode

Defined in:
lib/acts_as_runnable_code.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

VERSION =
"1.0.2"

Instance Method Summary collapse

Instance Method Details

#acts_as_runnable_code(options = {}) ⇒ Object

Mark this class as containing a method which returns user generated code. Options

  • options - contains a list of classes (unwrapped names) you want accessible in the sandbox. Default: all classes loaded and marked with acts_as_wrapped_class

  • options - only create 1 sandbox, which is always used whenever code is evaled (faster), rather than a new sandbox each time. Default: false

  • options - create sandbox using Sandbox.new rather than Sandbox.safe. Default: false

  • options - timeout in seconds before aborting user code. Default: none

  • options - the name of the method to call to get the user code for running. Default: :code



91
92
93
94
95
96
# File 'lib/acts_as_runnable_code.rb', line 91

def acts_as_runnable_code(options = {})
  self.send(:include, InstanceMethods)
  self.send(:extend,ClassMethods)
  
  self.runnable_code_options = options
end

#runnable_code?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/acts_as_runnable_code.rb', line 98

def runnable_code?
  false
end