Class: Lesmok::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/lesmok/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#available_cache_storesObject

Returns the value of attribute available_cache_stores.



6
7
8
# File 'lib/lesmok/config.rb', line 6

def available_cache_stores
  @available_cache_stores
end

#cacheObject

Returns the value of attribute cache.



4
5
6
# File 'lib/lesmok/config.rb', line 4

def cache
  @cache
end

#caching_enabledObject

Returns the value of attribute caching_enabled.



5
6
7
# File 'lib/lesmok/config.rb', line 5

def caching_enabled
  @caching_enabled
end

#debugging_enabledObject Also known as: debugging?

Returns the value of attribute debugging_enabled.



7
8
9
# File 'lib/lesmok/config.rb', line 7

def debugging_enabled
  @debugging_enabled
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/lesmok/config.rb', line 3

def logger
  @logger
end

#raise_errors_enabledObject Also known as: raise_errors?

Returns the value of attribute raise_errors_enabled.



8
9
10
# File 'lib/lesmok/config.rb', line 8

def raise_errors_enabled
  @raise_errors_enabled
end

Instance Method Details

#caching?Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/lesmok/config.rb', line 21

def caching?
  return false if !@caching_enabled
  @caching_enabled.kind_of?(Proc) ? @caching_enabled.call : true
end

#find_cache_store(name = nil) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/lesmok/config.rb', line 26

def find_cache_store(name = nil)
  name  ||= :default
  avail_stores = (available_cache_stores || {})
  store   = avail_stores[name.to_sym]
  store ||= avail_stores[:default]
  store ||= cache
end

#rails?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/lesmok/config.rb', line 34

def rails?
  Object.const_defined? "Rails"
end