Class: Neovim::Handler

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

Direct Known Subclasses

HandlerPlain

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type = nil, sync = nil, **options, &block) ⇒ Handler

Returns a new instance of Handler.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/neovim/handler.rb', line 14

def initialize name, type = nil, sync = nil, **options, &block
  @block = block
  standardize options
  @spec = {
    name: name,
    opts: options,
    type: type,
    sync: sync,
  }
  @spec.compact!
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



12
13
14
# File 'lib/neovim/handler.rb', line 12

def spec
  @spec
end

Instance Method Details

#execute(*args) ⇒ Object



33
# File 'lib/neovim/handler.rb', line 33

def execute *args ; @block.call *args ; end

#nameObject



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

def name ; @spec[ :name] ; end

#needs_client?Boolean

Returns:

  • (Boolean)


32
# File 'lib/neovim/handler.rb', line 32

def needs_client? ; true ; end

#optsObject Also known as: options



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

def opts ; @spec[ :opts] ; end

#syncObject Also known as: sync?



29
# File 'lib/neovim/handler.rb', line 29

def sync ; @spec[ :sync] ; end