Sha256: c6f50fab8437f3f38ceec998ecb8bcbcb114de2a65776bb8a53164694d189327

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 Bytes

Contents

module Crystal
  @plugin_initializers = {}
  class << self
    attr_accessor :plugin_initializers
  
    def initialize_plugin type, dir, *args, &block
      type = type.to_s      
      plugin_initializers.must.include(type)
      
      pi_class = plugin_initializers[type]
      pi = pi_class.new dir, *args
      block.call pi if block
    end
  end
end

require 'crystal_ext/plugin/web'
crystal.plugin_initializers['web'] = Crystal::Plugin::Web

require 'crystal_ext/plugin/app'
crystal.plugin_initializers['app'] = Crystal::Plugin::App

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crystal_ext-0.0.5 lib/crystal_ext/plugin.rb
crystal_ext-0.0.4 lib/crystal_ext/plugin.rb