Class: Cnfg::Filesystem

Inherits:
Object
  • Object
show all
Defined in:
lib/cnfg/filesystem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Filesystem

Returns a new instance of Filesystem.



7
8
9
# File 'lib/cnfg/filesystem.rb', line 7

def initialize(filename)
  @filename = ".#{filename}rc"
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



5
6
7
# File 'lib/cnfg/filesystem.rb', line 5

def filename
  @filename
end

Instance Method Details

#readObject



11
12
13
14
# File 'lib/cnfg/filesystem.rb', line 11

def read
  return {} unless File.exists?(path)
  contents.inject({}){|m,(k,v)| m[k.to_sym] = v; m}
end