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 =
'1.1.0'

Class Method Summary collapse

Class Method Details

.configurationObject



16
17
18
# File 'lib/constantizer.rb', line 16

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



20
21
22
# File 'lib/constantizer.rb', line 20

def self.configure
  yield(configuration)
end

.load!(path) ⇒ Object



7
8
9
10
# File 'lib/constantizer.rb', line 7

def self.load!(path)
  @path = path
  Dir.glob(File.join(path,'/*.yml')).each { |file| YAML.load(ERB.new(IO.read(file)).result).each { |k, v| Object.const_set k.upcase, v } }
end

.reload!Object



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

def self.reload!
  load! @path
end