Class: Blackbeard::Configuration
- Inherits:
-
Object
- Object
- Blackbeard::Configuration
- Defined in:
- lib/blackbeard/configuration.rb
Instance Attribute Summary collapse
-
#group_definitions ⇒ Object
readonly
Returns the value of attribute group_definitions.
-
#guest_method ⇒ Object
Returns the value of attribute guest_method.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#redis ⇒ Object
Returns the value of attribute redis.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
Instance Method Summary collapse
- #db ⇒ Object
- #define_group(id, segments = nil, &block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #tz ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 |
# File 'lib/blackbeard/configuration.rb', line 10 def initialize @timezone = 'America/Los_Angeles' @namespace = 'Blackbeard' @group_definitions = {} @redis = nil end |
Instance Attribute Details
#group_definitions ⇒ Object (readonly)
Returns the value of attribute group_definitions.
8 9 10 |
# File 'lib/blackbeard/configuration.rb', line 8 def group_definitions @group_definitions end |
#guest_method ⇒ Object
Returns the value of attribute guest_method.
7 8 9 |
# File 'lib/blackbeard/configuration.rb', line 7 def guest_method @guest_method end |
#namespace ⇒ Object
Returns the value of attribute namespace.
7 8 9 |
# File 'lib/blackbeard/configuration.rb', line 7 def namespace @namespace end |
#redis ⇒ Object
Returns the value of attribute redis.
7 8 9 |
# File 'lib/blackbeard/configuration.rb', line 7 def redis @redis end |
#timezone ⇒ Object
Returns the value of attribute timezone.
7 8 9 |
# File 'lib/blackbeard/configuration.rb', line 7 def timezone @timezone end |
Instance Method Details
#db ⇒ Object
17 18 19 |
# File 'lib/blackbeard/configuration.rb', line 17 def db @db ||= RedisStore.new(@redis, @namespace) end |
#define_group(id, segments = nil, &block) ⇒ Object
25 26 27 28 29 |
# File 'lib/blackbeard/configuration.rb', line 25 def define_group(id, segments = nil, &block) group = Group.find_or_create(id) group.add_segments(segments || id) @group_definitions[id.to_sym] = block end |
#tz ⇒ Object
21 22 23 |
# File 'lib/blackbeard/configuration.rb', line 21 def tz @tz ||= TZInfo::Timezone.get(@timezone) end |