Class: Filedots::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/filedots/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



6
7
8
# File 'lib/filedots/config.rb', line 6

def initialize
  @links = []
end

Instance Attribute Details

Returns the value of attribute links.



4
5
6
# File 'lib/filedots/config.rb', line 4

def links
  @links
end

Instance Method Details



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/filedots/config.rb', line 10

def link(source, target=nil)
  if source.is_a?(Array)
    source.each { |s| link(s) }
    return
  end

  target ||= File.expand_path("~/.#{source}")
  source = File.expand_path("#{Dir.pwd}/#{source}")

  @links << [source, target]
end