Class: Neovim::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/neovim/plugin.rb,
lib/neovim/plugin/dsl.rb,
lib/neovim/plugin/handler.rb

Defined Under Namespace

Classes: DSL, Handler

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Plugin

Returns a new instance of Plugin.



18
19
20
21
# File 'lib/neovim/plugin.rb', line 18

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

Instance Attribute Details

#handlersObject

Returns the value of attribute handlers.



5
6
7
# File 'lib/neovim/plugin.rb', line 5

def handlers
  @handlers
end

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/neovim/plugin.rb', line 6

def source
  @source
end

Class Method Details

.from_config_block(source) {|DSL| ... } ⇒ Object

Entrypoint to the Neovim.plugin DSL.

Parameters:

  • source (String)

    The path of the plugin file.

Yields:

  • (DSL)

    The receiver of DSL methods.



12
13
14
15
16
# File 'lib/neovim/plugin.rb', line 12

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

Instance Method Details

#specsArray

Returns Handler specs used by nvim to register plugins.

Returns:

  • (Array)

    Handler specs used by nvim to register plugins.



24
25
26
# File 'lib/neovim/plugin.rb', line 24

def specs
  @handlers.map(&:to_spec)
end