class NvimConf::Core

Public Class Methods

define(&block) click to toggle source
# File lib/nvim_conf/core.rb, line 3
def self.define(&block)
  new.instance_eval(&block)

  NvimConf::Writer.new(
    NvimConf.managers
  ).write
end

Public Instance Methods

commands(&block) click to toggle source
# File lib/nvim_conf/core.rb, line 18
def commands(&block)
  evaluate_for_manager(
    Managers::Commands.new,
    &block
  )
end
configuration(&block) click to toggle source
# File lib/nvim_conf/core.rb, line 53
def configuration(&block)
  evaluate_for_manager(
    Managers::CompilerConfigurations.new,
    &block
  )
end
globals(&block) click to toggle source
# File lib/nvim_conf/core.rb, line 32
def globals(&block)
  evaluate_for_manager(
    Managers::Globals.new,
    &block
  )
end
mappings(namespace = nil, &block) click to toggle source
# File lib/nvim_conf/core.rb, line 46
def mappings(namespace = nil, &block)
  evaluate_for_manager(
    Managers::Mappings.new(namespace),
    &block
  )
end
plugins(name, title: nil, bootstraped: false, &block) click to toggle source
# File lib/nvim_conf/core.rb, line 11
def plugins(name, title: nil, bootstraped: false, &block)
  evaluate_for_manager(
    Managers::Plugins.new(name, title, bootstraped: bootstraped),
    &block
  )
end
requires(&block) click to toggle source
# File lib/nvim_conf/core.rb, line 25
def requires(&block)
  evaluate_for_manager(
    Managers::Requires.new,
    &block
  )
end
settings(title = nil, &block) click to toggle source
# File lib/nvim_conf/core.rb, line 39
def settings(title = nil, &block)
  evaluate_for_manager(
    Managers::Settings.new(title),
    &block
  )
end

Private Instance Methods

evaluate_for_manager(manager, &block) click to toggle source
# File lib/nvim_conf/core.rb, line 62
def evaluate_for_manager(manager, &block)
  manager.instance_eval(&block)
  store_manager(manager)
end
store_manager(manager) click to toggle source
# File lib/nvim_conf/core.rb, line 67
def store_manager(manager)
  return unless manager.send(:store?)

  NvimConf.managers.push(
    manager
  )
end