Class: Colorit::Coloritrc

Inherits:
Config
  • Object
show all
Defined in:
lib/colorit/coloritrc.rb

Instance Attribute Summary

Attributes inherited from Config

#colors

Instance Method Summary collapse

Methods inherited from Config

#debug=, #debug?

Constructor Details

#initialize(rcpath = '~/.coloritrc') ⇒ Coloritrc

Returns a new instance of Coloritrc.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/colorit/coloritrc.rb', line 4

def initialize(rcpath = '~/.coloritrc')
  super()

  rcpath = File.expand_path(rcpath)
  if File.readable?(rcpath)
    File.readlines(rcpath).each do |line|
      key,val = line.strip.split(':', 2)

      unless key.nil?
        send(key, val) if respond_to?(key.to_sym)
      end
    end
  end
end