Sha256: 2a5971671e951a42cc50d14aae8fc0571222e9f31129e822142c9c516476f53a

Contents?: true

Size: 815 Bytes

Versions: 23

Compression:

Stored size: 815 Bytes

Contents

# frozen_string_literal: true

module Praxis
  # one instance is created per use.
  class Plugin
    attr_accessor :application, :block, :config, :config_attribute

    def options
      @options ||= {}
    end

    def config_key; end

    def prepare_config!(node); end

    def load_config!
      return unless options.key?(:config_file)
      return {} unless (application.root + options[:config_file]).exist?

      YAML.load_file(application.root + options[:config_file])
    end

    def setup!; end

    def register_doc_browser_plugin(path)
      application.doc_browser_plugin_paths << File.expand_path(path)
    end

    def after(stage, &block)
      application.bootloader.after(stage, &block)
    end

    def before(stage, &block)
      application.bootloader.before(stage, &block)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
praxis-2.0.pre.21 lib/praxis/plugin.rb
praxis-2.0.pre.20 lib/praxis/plugin.rb
praxis-2.0.pre.19 lib/praxis/plugin.rb