Class: BucketMaker::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/bucket_maker/configuration.rb

Overview

Configuration Holder for the BucketMaker

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Initializer Sets up the default variable values



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bucket_maker/configuration.rb', line 21

def initialize
  # For Redis
  @redis_options = {
    host:    'localhost',
    port:    6379,
    db:      1
  }
  @redis_expiration_time = 12.months

  # For paths
  # If nil, the routes wont be loaded
  @path_prefix = '2bOrNot2B/'

  # Configuration for the buckets
  #
  @buckets_config_file = nil
  @buckets_configuration = nil

  # Lazy Load is used to group only if in_bucket? is called
  # if false, then the group is done at creation time of the objec as well
  #
  @lazy_load = true
end

Instance Attribute Details

#buckets_config_fileObject

Returns the value of attribute buckets_config_file.



9
10
11
# File 'lib/bucket_maker/configuration.rb', line 9

def buckets_config_file
  @buckets_config_file
end

#buckets_configurationObject (readonly)

Returns the value of attribute buckets_configuration.



15
16
17
# File 'lib/bucket_maker/configuration.rb', line 15

def buckets_configuration
  @buckets_configuration
end

#connectionObject (readonly)

Returns the value of attribute connection.



15
16
17
# File 'lib/bucket_maker/configuration.rb', line 15

def connection
  @connection
end

#lazy_loadObject

Returns the value of attribute lazy_load.



9
10
11
# File 'lib/bucket_maker/configuration.rb', line 9

def lazy_load
  @lazy_load
end

#path_prefixObject

Returns the value of attribute path_prefix.



9
10
11
# File 'lib/bucket_maker/configuration.rb', line 9

def path_prefix
  @path_prefix
end

#redis_expiration_timeObject

Returns the value of attribute redis_expiration_time.



9
10
11
# File 'lib/bucket_maker/configuration.rb', line 9

def redis_expiration_time
  @redis_expiration_time
end

#redis_optionsObject

Returns the value of attribute redis_options.



9
10
11
# File 'lib/bucket_maker/configuration.rb', line 9

def redis_options
  @redis_options
end

Instance Method Details

#configured?Boolean

Check if the configuration is done

Returns:

  • (Boolean)


57
58
59
# File 'lib/bucket_maker/configuration.rb', line 57

def configured?
  @buckets_configuration && @buckets_configuration.configured?
end

#load_routes?Boolean

Check if its ok to load routes

Returns:

  • (Boolean)


65
66
67
# File 'lib/bucket_maker/configuration.rb', line 65

def load_routes?
  @path_prefix != nil
end

#reconfigure!Object

Reconfigure the Configuration



47
48
49
50
51
52
# File 'lib/bucket_maker/configuration.rb', line 47

def reconfigure!
  if @buckets_config_file
    @buckets_configuration = BucketMaker::SeriesMaker.instance
    @buckets_configuration.make!(@buckets_config_file)
  end
end