Method: Castaway::Production::ClassMethods#from_script

Defined in:
lib/castaway/production/class_methods.rb

#from_script(file) ⇒ Object

Treats the given ‘file` as a Castaway script, and evaluates it in the context of a new, anonymous subclass of Castaway::Production. This new subclass is returned.



137
138
139
140
141
142
143
144
145
# File 'lib/castaway/production/class_methods.rb', line 137

def from_script(file)
  Class.new(self) do
    class_eval File.read(file), file
  end
rescue Exception => e
  puts "#{e.class} (#{e.message})"
  puts e.backtrace
  abort
end