Sha256: 67d3b0c70735bf3dde365fb9401a1501975e29dee9bb122b84f60a4481a2af82

Contents?: true

Size: 725 Bytes

Versions: 3

Compression:

Stored size: 725 Bytes

Contents

require "neovim/plugin/dsl"

module Neovim
  # @api private
  class Plugin
    attr_accessor :handlers
    attr_reader :source

    # Entrypoint to the +Neovim.plugin+ DSL.
    #
    # @param source [String] The path of the plugin file.
    # @yield [DSL] The receiver of DSL methods.
    def self.from_config_block(source)
      new(source).tap do |instance|
        yield DSL.new(instance) if block_given?
      end
    end

    def initialize(source)
      @handlers = []
      @source = source
    end

    # @return [Array] Handler specs used by +nvim+ to register plugins.
    def specs
      @handlers.inject([]) do |acc, handler|
        handler.qualified? ? acc + [handler.to_spec] : acc
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
neovim-0.2.5 lib/neovim/plugin.rb
neovim-0.2.4 lib/neovim/plugin.rb
neovim-0.2.3 lib/neovim/plugin.rb