Module: Smelter::Scriptable

Defined in:
lib/smelter/scriptable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Scriptable classes must support the following methods class Script

include Smelter::Scriptable

runner_include Buzzsaw::DSL

def self.find(id)
  returns a script object
end

def id
  returns the id of the script
end

def source
  returns the source file for the script
end

end



23
24
25
26
27
# File 'lib/smelter/scriptable.rb', line 23

def self.included(base)
  base.class_eval do
    extend ClassMethods
  end
end

Instance Method Details

#registerObject



29
30
31
32
33
34
# File 'lib/smelter/scriptable.rb', line 29

def register
  # NOTE: This returns a populated instance of ScriptRunner
  # that has all extensions defined on it and contains
  # Procs for the code defined in source
  instance_eval source, id, 1
end