Class: Most::Core
Defined Under Namespace
Classes: UnregisteredExtensionError
Instance Method Summary collapse
-
#initialize ⇒ Core
constructor
A new instance of Core.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Core
Returns a new instance of Core.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/most/core.rb', line 29 def initialize() @environment = SERVICES[:environment] = @environment. @strategies = register_strategies() @last_eval_result = nil load_objects() end |
Instance Method Details
#run ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/most/core.rb', line 40 def run() result = nil submission = [:submission] paths = form_paths(submission) extension = File.extname(submission) proc = @strategies[extension] unless proc.nil? result = proc.call(paths) else exception = UnregisteredExtensionError.new("#{extension} is not registered") @environment.log_error(exception, "Only 'rb' or 'yml' extensions are allowed") end result end |