Module: Constantizer
- Defined in:
- lib/constantizer.rb,
lib/constantizer/version.rb,
lib/constantizer/configuration.rb,
lib/constantizer/rack/reloader.rb,
lib/constantizer/integration/rails.rb,
lib/constantizer/integration/sinatra.rb
Defined Under Namespace
Modules: Integration, Rack, Sinatra
Classes: Configuration
Constant Summary
collapse
- VERSION =
'2.0.0'
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
20
21
22
|
# File 'lib/constantizer.rb', line 20
def self.configuration
@configuration ||= Configuration.new
end
|
24
25
26
|
# File 'lib/constantizer.rb', line 24
def self.configure
yield(configuration)
end
|
.load!(path) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/constantizer.rb', line 7
def self.load!(path)
@path = path
Dir.glob(File.join(path,'/*.yml')).each do |file|
YAML.load(IO.read(file)).each do |key, value|
Kernel.const_set(key.upcase, value)
end
end
end
|
.reload! ⇒ Object
16
17
18
|
# File 'lib/constantizer.rb', line 16
def self.reload!
load! @path
end
|