class Mumukit::Runtime

Public Class Methods

new(config) click to toggle source
# File lib/mumukit/runtime/runtime.rb, line 5
def initialize(config)
  @config = config
  @hook_classes = {}
end

Public Instance Methods

hook_class(hook_name) click to toggle source
# File lib/mumukit/runtime/runtime.rb, line 28
def hook_class(hook_name)
  @hook_classes[hook_name] ||=
      if hook_defined? hook_name
        hook_name.to_mumukit_hook_class
      else
        hook_name.to_default_mumukit_hook_class
      end
end
hook_defined?(hook_name) click to toggle source
# File lib/mumukit/runtime/runtime.rb, line 14
def hook_defined?(hook_name)
  hook_name.to_default_mumukit_hook_class rescue raise "Wrong hook #{hook_name}"

  Kernel.const_defined? hook_name.to_mumukit_hook_class_name
end
hook_includes?(hook_name, mixin) click to toggle source
# File lib/mumukit/runtime/runtime.rb, line 20
def hook_includes?(hook_name, mixin)
  hook_class(hook_name).included_modules.include?(mixin)
end
new_hook(hook_name) click to toggle source
# File lib/mumukit/runtime/runtime.rb, line 24
def new_hook(hook_name)
  hook_class(hook_name).new(@config)
end
reset!() click to toggle source
# File lib/mumukit/runtime/runtime.rb, line 10
def reset!
  @hook_classes = {}
end