Sha256: 4fb9808165819a55725c8f77c10bd3c92dac113747a657e3f45d140a4bcb602f

Contents?: true

Size: 709 Bytes

Versions: 5

Compression:

Stored size: 709 Bytes

Contents

require "neovim/plugin/dsl"

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

    def self.from_config_block(source)
      new(source).tap do |instance|
        yield DSL.new(instance) if block_given?
      end
    end

    def initialize(source)
      @source = source
      @handlers = []
      @setup_blocks = []
      @script_host = false
    end

    def specs
      @handlers.inject([]) do |acc, handler|
        handler.qualified? ? acc + [handler.to_spec] : acc
      end
    end

    def setup(client)
      @setup_blocks.each { |bl| bl.call(client) }
    end

    def script_host?
      !!@script_host
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
neovim-0.10.0 lib/neovim/plugin.rb
neovim-0.9.1 lib/neovim/plugin.rb
neovim-0.9.0 lib/neovim/plugin.rb
neovim-0.9.0.pre.1 lib/neovim/plugin.rb
neovim-0.8.1 lib/neovim/plugin.rb