Class: VimEpidemic::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vim-epidemic/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



7
8
9
10
# File 'lib/vim-epidemic/config.rb', line 7

def initialize
  @plugins = []
  @home = File.expand_path '~'
end

Instance Attribute Details

#pluginsObject (readonly)

Returns the value of attribute plugins.



5
6
7
# File 'lib/vim-epidemic/config.rb', line 5

def plugins
  @plugins
end

Instance Method Details

#add(*args, &block) ⇒ Object



24
25
26
# File 'lib/vim-epidemic/config.rb', line 24

def add *args, &block
  @plugins << Plugin.new(self, *args, block)
end

#bundle_dirObject



40
41
42
# File 'lib/vim-epidemic/config.rb', line 40

def bundle_dir
  File.join @home, '.vim', 'bundle'
end

#configure(&block) ⇒ Object



28
29
30
# File 'lib/vim-epidemic/config.rb', line 28

def configure &block
  self.instance_eval &block
end

#empty?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/vim-epidemic/config.rb', line 20

def empty?
  @plugins.empty?
end

#exists?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/vim-epidemic/config.rb', line 36

def exists?
  File.exists? file
end

#fileObject



32
33
34
# File 'lib/vim-epidemic/config.rb', line 32

def file
  File.join @home, '.epidemic.vim.rb'
end

#has?(*args) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/vim-epidemic/config.rb', line 16

def has? *args
  @plugins.find{ |p| p.match? *args }
end

#touchObject



12
13
14
# File 'lib/vim-epidemic/config.rb', line 12

def touch
  FileUtils.touch file
end