class Neovim::Plugin::Handler

@api private

Attributes

block[R]

Public Class Methods

new(source, type, name, sync, options, block) click to toggle source
# 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
unqualified(name, block) click to toggle source
# File lib/neovim/plugin/handler.rb, line 7
def self.unqualified(name, block)
  new(nil, nil, name, true, {qualified: false}, block)
end

Public Instance Methods

call(*args) click to toggle source
# File lib/neovim/plugin/handler.rb, line 50
def call(*args)
  @block.call(*args)
end
qualified?() click to toggle source
# File lib/neovim/plugin/handler.rb, line 26
def qualified?
  @qualified
end
qualified_name() click to toggle source
# 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?() click to toggle source
# File lib/neovim/plugin/handler.rb, line 22
def sync?
  !!@sync
end
to_spec() click to toggle source
# File lib/neovim/plugin/handler.rb, line 41
def to_spec
  {
    type: @type,
    name: @name,
    sync: @sync,
    opts: @options
  }
end