Module: Qlg

Extended by:
Qlg
Included in:
Qlg
Defined in:
lib/qlg.rb

Constant Summary collapse

VERSION =
File.open(File.expand_path(File.join(File.dirname(__FILE__),'..','VERSION'))).read.freeze
LOGS =
Hash.new do |h,k|
  h[k] = Logger.new("#{k}.log")
end
DEFAULT_NAME =
ENV['RACK_ENV']||ENV['RAILS_ENV']||ENV['MERB_ENV']||'default'
DEFAULT =

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



29
30
31
# File 'lib/qlg.rb', line 29

def method_missing name
  LOGS[name]
end

Instance Method Details

#create_log(name) ⇒ Object

Not sure how much faster this is than method missing



19
20
21
22
23
24
25
26
27
# File 'lib/qlg.rb', line 19

def create_log name
  name = name.to_s
  
  Log.send :define_method, name do
    LOGS[name]
  end
  
  LOGS[name] # Initialize the log
end

#defaultObject



35
# File 'lib/qlg.rb', line 35

def default; DEFAULT; end