Class: Scheduler::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



19
20
21
22
23
24
25
26
27
# File 'lib/scheduler/configuration.rb', line 19

def initialize
  @environment = 'test'
  @mongoid_config_file = File.join(Scheduler.root, 'spec/mongoid.yml')
  @log_file = STDOUT
  @job_class = Scheduler::Examples::SchedulableModel
  @polling_interval = 5
  @max_concurrent_jobs = [ Etc.nprocessors, 24 ].min
  @perform_jobs_in_test_or_development = false
end

Instance Attribute Details

#environmentString

Returns envinronment of your app.

Returns:

  • (String)

    envinronment of your app



5
6
7
# File 'lib/scheduler/configuration.rb', line 5

def environment
  @environment
end

#job_classClass

Returns the class of the main job model.

Returns:

  • (Class)

    the class of the main job model.



11
12
13
# File 'lib/scheduler/configuration.rb', line 11

def job_class
  @job_class
end

#log_fileString

Returns a path to the specified log file.

Returns:

  • (String)

    a path to the specified log file.



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

def log_file
  @log_file
end

#max_concurrent_jobsInteger

Returns maximum number of concurent jobs.

Returns:

  • (Integer)

    maximum number of concurent jobs.



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

def max_concurrent_jobs
  @max_concurrent_jobs
end

#mongoid_config_fileString

Returns a path to Mongoid config file.

Returns:

  • (String)

    a path to Mongoid config file.



7
8
9
# File 'lib/scheduler/configuration.rb', line 7

def mongoid_config_file
  @mongoid_config_file
end

#perform_jobs_in_test_or_developmentProc

Returns whether to perform jobs when in test or development env.

Returns:

  • (Proc)

    whether to perform jobs when in test or development env.



17
18
19
# File 'lib/scheduler/configuration.rb', line 17

def perform_jobs_in_test_or_development
  @perform_jobs_in_test_or_development
end

#polling_intervalInteger

Returns how much time to wait before each iteration.

Returns:

  • (Integer)

    how much time to wait before each iteration.



13
14
15
# File 'lib/scheduler/configuration.rb', line 13

def polling_interval
  @polling_interval
end