Class: Leda::Configuration
- Inherits:
-
Object
- Object
- Leda::Configuration
show all
- Defined in:
- lib/leda/configuration.rb
Defined Under Namespace
Classes: DataUnitConfigurator
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Configuration.
9
10
11
12
13
14
15
16
|
# File 'lib/leda/configuration.rb', line 9
def initialize(&dsl)
@data_units_map = {}
@base_path = Pathname.new('db/leda')
if block_given?
update(&dsl)
end
end
|
Instance Attribute Details
#base_path ⇒ Object
Returns the value of attribute base_path.
7
8
9
|
# File 'lib/leda/configuration.rb', line 7
def base_path
@base_path
end
|
Instance Method Details
#base_dir ⇒ Object
49
50
51
|
# File 'lib/leda/configuration.rb', line 49
def base_dir
project_root_dir + base_path
end
|
#data_unit(name, &dsl) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/leda/configuration.rb', line 23
def data_unit(name, &dsl)
data_unit = (@data_units_map[name] ||= DataUnit.new(name))
if block_given?
dsl.call(DataUnitConfigurator.new(data_unit))
end
data_unit
end
|
#data_units ⇒ Object
33
34
35
|
# File 'lib/leda/configuration.rb', line 33
def data_units
@data_units_map.values
end
|
#project_root_dir ⇒ Object
37
38
39
|
# File 'lib/leda/configuration.rb', line 37
def project_root_dir
@project_root_dir or fail "Please set project_root_dir in your Leda configuration"
end
|
#project_root_dir=(path) ⇒ Object
41
42
43
|
# File 'lib/leda/configuration.rb', line 41
def project_root_dir=(path)
@project_root_dir = ensure_pathname(path)
end
|
#update(&dsl) ⇒ Object
18
19
20
21
|
# File 'lib/leda/configuration.rb', line 18
def update(&dsl)
dsl.call(self)
self
end
|