Class: MyDashboard::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration



16
17
18
19
20
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/my_dashboard/configuration.rb', line 16

def initialize
  @engine_path            = '/my_dashboard'
  @scheduler              = ::Rufus::Scheduler.new

  # Redis
  @redis_host             = '127.0.0.1'
  @redis_port             = '6379'
  @redis_password         = nil
  @redis_namespace        = 'my_dashboard_events'
  @redis_timeout          = 3

  # Authorization
  @auth_token             = nil
  @devise_allowed_models  = []

  # Jobs
  @jobs_path              = Rails.root.join('app', 'jobs')

  # Dashboards
  @default_dashboard      = nil
  @dashboards_views_path  = Rails.root.join('app', 'views', 'my_dashboard', 'dashboards')
  @dashboard_layout_path  = 'my_dashboard/dashboard'

  # Widgets
  @widgets_views_path     = Rails.root.join('app', 'views', 'my_dashboard', 'widgets')
  @widgets_js_path        = Rails.root.join('app', 'assets', 'javascripts', 'my_dashboard')
  @widgets_css_path       = Rails.root.join('app', 'assets', 'stylesheets', 'my_dashboard')
end

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



10
11
12
# File 'lib/my_dashboard/configuration.rb', line 10

def auth_token
  @auth_token
end

#dashboard_layout_pathObject

Returns the value of attribute dashboard_layout_path.



12
13
14
# File 'lib/my_dashboard/configuration.rb', line 12

def dashboard_layout_path
  @dashboard_layout_path
end

#dashboards_views_pathObject

Returns the value of attribute dashboards_views_path.



12
13
14
# File 'lib/my_dashboard/configuration.rb', line 12

def dashboards_views_path
  @dashboards_views_path
end

#default_dashboardObject

Returns the value of attribute default_dashboard.



12
13
14
# File 'lib/my_dashboard/configuration.rb', line 12

def default_dashboard
  @default_dashboard
end

#devise_allowed_modelsObject

Returns the value of attribute devise_allowed_models.



10
11
12
# File 'lib/my_dashboard/configuration.rb', line 10

def devise_allowed_models
  @devise_allowed_models
end

#engine_pathObject

Returns the value of attribute engine_path.



14
15
16
# File 'lib/my_dashboard/configuration.rb', line 14

def engine_path
  @engine_path
end

#jobs_pathObject

Returns the value of attribute jobs_path.



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

def jobs_path
  @jobs_path
end

#redisObject (readonly)

Returns the value of attribute redis.



8
9
10
# File 'lib/my_dashboard/configuration.rb', line 8

def redis
  @redis
end

#redis_hostObject

Returns the value of attribute redis_host.



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

def redis_host
  @redis_host
end

#redis_namespaceObject

Returns the value of attribute redis_namespace.



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

def redis_namespace
  @redis_namespace
end

#redis_passwordObject

Returns the value of attribute redis_password.



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

def redis_password
  @redis_password
end

#redis_portObject

Returns the value of attribute redis_port.



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

def redis_port
  @redis_port
end

#redis_timeoutObject

Returns the value of attribute redis_timeout.



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

def redis_timeout
  @redis_timeout
end

#schedulerObject

Returns the value of attribute scheduler.



14
15
16
# File 'lib/my_dashboard/configuration.rb', line 14

def scheduler
  @scheduler
end

#widgets_css_pathObject

Returns the value of attribute widgets_css_path.



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

def widgets_css_path
  @widgets_css_path
end

#widgets_js_pathObject

Returns the value of attribute widgets_js_path.



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

def widgets_js_path
  @widgets_js_path
end

#widgets_views_pathObject

Returns the value of attribute widgets_views_path.



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

def widgets_views_path
  @widgets_views_path
end

Instance Method Details

#new_redis_connectionObject



49
50
51
# File 'lib/my_dashboard/configuration.rb', line 49

def new_redis_connection
  ::Redis.new(host: redis_host, port: redis_port, password: redis_password)
end