Module: Envoku

Defined in:
lib/envoku.rb,
lib/envoku/rails.rb,
lib/envoku/utils.rb,
lib/envoku/logger.rb,
lib/envoku/feature.rb,
lib/envoku/version.rb,
lib/envoku/resource.rb,
lib/envoku/adapters.rb,
lib/envoku/adapters/s3.rb

Defined Under Namespace

Modules: Adapters, Resource, Utils Classes: Feature, Logger, Railtie

Constant Summary collapse

URL =
Envoku::Utils.parsed_url
URI =
Envoku::Utils.parsed_uri
VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.feature_enabled_for?(feature_name, resource) ⇒ Boolean


7
8
9
# File 'lib/envoku/feature.rb', line 7

def feature_enabled_for?(feature_name, resource)
  Feature.new(feature_name).enabled_for?(resource)
end

.features_enabled_for(resource) ⇒ Object


11
12
13
# File 'lib/envoku/feature.rb', line 11

def features_enabled_for(resource)
  redis.smembers("#{Feature::REDIS_NAMESPACE}#{resource.class.name}:#{resource.id}")
end

.get(key) ⇒ Object


34
35
36
37
38
# File 'lib/envoku.rb', line 34

def get(key)
  adapter = Envoku::Adapters::S3.new
  adapter.load
  adapter.get(key)
end

.get_allObject


28
29
30
31
32
# File 'lib/envoku.rb', line 28

def get_all
  adapter = Envoku::Adapters::S3.new
  adapter.load
  adapter.get_all
end

.load(options = {}) ⇒ Object


22
23
24
25
26
# File 'lib/envoku.rb', line 22

def load(options = {})
  Envoku.logger.info("load using S3 adapter")
  instance = Envoku::Adapters::S3.new(options)
  instance.load
end

.loggerObject


7
8
9
# File 'lib/envoku/logger.rb', line 7

def logger
  @_logger ||= Envoku::Logger.new(STDOUT)
end

.logger=(logger) ⇒ Object


11
12
13
# File 'lib/envoku/logger.rb', line 11

def logger=(logger)
  @_logger = logger
end

.redisObject


46
47
48
49
50
# File 'lib/envoku.rb', line 46

def redis
  @redis ||= ::Redis.new(
    url: (ENV['ENVOKU_REDIS_URL'] || ENV['REDIS_URL']),
  )
end

.set(key, value) ⇒ Object


40
41
42
43
44
# File 'lib/envoku.rb', line 40

def set(key, value)
  adapter = Envoku::Adapters::S3.new
  adapter.load
  adapter.set(key, value)
end