class AllSeeingEye
Public Class Methods
configuration()
click to toggle source
# File lib/all_seeing_eye.rb, line 6 def self.configuration location = ENV['ALL_SEEING_EYE_CONFIG'] || 'config' @@configuration ||= Hash.new @@configuration[:all_seeing_eye] ||= YAML::load_file("./#{location}/all_seeing_eye.yml") @@configuration[:redis] ||= if @@configuration[:all_seeing_eye]['redis'] && @@configuration[:all_seeing_eye]['redis'][AllSeeingEye.environment] @@configuration[:all_seeing_eye]['redis'][AllSeeingEye.environment] else begin YAML::load_file("./#{location}/resque.yml")[AllSeeingEye.environment] rescue begin YAML::load_file("./#{location}/redis.yml")[AllSeeingEye.environment] rescue 'localhost:6379' end end end @@configuration[:models] ||= [] @@configuration[:all_seeing_eye].each do |key, value| next if self.default_keys.include?(key) || AllSeeingEye.const_defined?(key.capitalize.to_sym) klass = Class.new(AllSeeingEye::Model) AllSeeingEye.const_set(key.capitalize.to_sym, klass) @@configuration[:models] << klass end @@configuration end
default_keys()
click to toggle source
# File lib/all_seeing_eye.rb, line 34 def self.default_keys ['timeout', 'round_to_seconds', 'redis'] end
environment()
click to toggle source
# File lib/all_seeing_eye.rb, line 2 def self.environment ENV['RUBBER_ENV'] || ENV['RAILS_ENV'] || ENV['ALL_SEEING_EYE_ENV'] || 'development' end
redis()
click to toggle source
# File lib/all_seeing_eye.rb, line 38 def self.redis @@redis ||= Redis.new(:host => AllSeeingEye.configuration[:redis].split(':').first, :port => AllSeeingEye.configuration[:redis].split(':').last, :db => 7) end