Class: Neovim::Plugin::Handler Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, type, name, sync, options, block) ⇒ Handler

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Handler.

API:

  • private



11
12
13
14
15
16
17
18
19
20
# File 'lib/neovim/plugin/handler.rb', line 11

def initialize(source, type, name, sync, options, block)
  @source = source
  @type = type.to_sym if type.respond_to?(:to_sym)
  @name = name.to_s
  @sync = sync
  @options = options
  @block = block || -> {}
  @qualified =
    options.key?(:qualified) ? options.delete(:qualified) : true
end

Instance Attribute Details

#blockObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



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

def block
  @block
end

Class Method Details

.unqualified(name, block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



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

def self.unqualified(name, block)
  new(nil, nil, name, true, {qualified: false}, block)
end

Instance Method Details

#call(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



50
51
52
# File 'lib/neovim/plugin/handler.rb', line 50

def call(*args)
  @block.call(*args)
end

#qualified?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



26
27
28
# File 'lib/neovim/plugin/handler.rb', line 26

def qualified?
  @qualified
end

#qualified_nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



30
31
32
33
34
35
36
37
38
39
# File 'lib/neovim/plugin/handler.rb', line 30

def qualified_name
  return @name unless qualified?

  if @type == :autocmd
    pattern = @options.fetch(:pattern, "*")
    "#{@source}:#{@type}:#{@name}:#{pattern}"
  else
    "#{@source}:#{@type}:#{@name}"
  end
end

#sync?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



22
23
24
# File 'lib/neovim/plugin/handler.rb', line 22

def sync?
  !!@sync
end

#to_specObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



41
42
43
44
45
46
47
48
# File 'lib/neovim/plugin/handler.rb', line 41

def to_spec
  {
    type: @type,
    name: @name,
    sync: @sync,
    opts: @options
  }
end