Class: Incept::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/incept/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Configuration

Returns a new instance of Configuration.



12
13
14
# File 'lib/incept/configuration.rb', line 12

def initialize(path)
  @path = path
end

Class Method Details

.loadObject



8
9
10
# File 'lib/incept/configuration.rb', line 8

def self.load
  new(path)
end

.pathObject



4
5
6
# File 'lib/incept/configuration.rb', line 4

def self.path
  File.expand_path('../../../templates', __FILE__)
end

Instance Method Details

#directoriesObject



16
17
18
19
20
21
# File 'lib/incept/configuration.rb', line 16

def directories
  @directories ||= begin
    names = Directory.names_for(@path)
    names.map {|name| Directory.new("#{@path}/#{name}") }
  end
end

#map(&block) ⇒ Object



23
24
25
# File 'lib/incept/configuration.rb', line 23

def map(&block)
  to_hash.map(&block)
end

#to_hashObject



27
28
29
# File 'lib/incept/configuration.rb', line 27

def to_hash
  @to_hash ||= directories.inject({}) {|h, d| h.merge(d.to_hash) }
end