Class: Incept::Configuration
- Inherits:
-
Object
- Object
- Incept::Configuration
- Defined in:
- lib/incept/configuration.rb
Class Method Summary collapse
Instance Method Summary collapse
- #directories ⇒ Object
-
#initialize(path) ⇒ Configuration
constructor
A new instance of Configuration.
- #map(&block) ⇒ Object
- #to_hash ⇒ Object
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
.load ⇒ Object
8 9 10 |
# File 'lib/incept/configuration.rb', line 8 def self.load new(path) end |
.path ⇒ Object
4 5 6 |
# File 'lib/incept/configuration.rb', line 4 def self.path File.('../../../templates', __FILE__) end |
Instance Method Details
#directories ⇒ Object
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_hash ⇒ Object
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 |