Class: Newshound::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/newshound/configuration.rb', line 12

def initialize
  @exception_limit = 10
  @enabled = true
  @authorized_roles = [:developer, :super_user]
  @current_user_method = :current_user
  @authorization_block = nil
  @exception_source = :exception_track
  @exception_source_config = {}
  @warning_source = nil
  @warning_limit = 10
  @job_source = nil
  @failed_jobs_threshold = 0
  @exception_links = {}
  @job_links = {}
  @warning_links = {}
end

Instance Attribute Details

#authorization_blockObject

Returns the value of attribute authorization_block.



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

def authorization_block
  @authorization_block
end

#authorized_rolesObject

Returns the value of attribute authorized_roles.



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

def authorized_roles
  @authorized_roles
end

#current_user_methodObject

Returns the value of attribute current_user_method.



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

def current_user_method
  @current_user_method
end

#enabledObject

Returns the value of attribute enabled.



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

def enabled
  @enabled
end

#exception_limitObject

Returns the value of attribute exception_limit.



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

def exception_limit
  @exception_limit
end

Returns the value of attribute exception_links.



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

def exception_links
  @exception_links
end

#exception_sourceObject

Returns the value of attribute exception_source.



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

def exception_source
  @exception_source
end

#exception_source_configObject

Returns the value of attribute exception_source_config.



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

def exception_source_config
  @exception_source_config
end

#failed_jobs_thresholdObject

Returns the value of attribute failed_jobs_threshold.



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

def failed_jobs_threshold
  @failed_jobs_threshold
end

Returns the value of attribute job_links.



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

def job_links
  @job_links
end

#job_sourceObject

Returns the value of attribute job_source.



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

def job_source
  @job_source
end

#warning_limitObject

Returns the value of attribute warning_limit.



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

def warning_limit
  @warning_limit
end

Returns the value of attribute warning_links.



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

def warning_links
  @warning_links
end

#warning_sourceObject

Returns the value of attribute warning_source.



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

def warning_source
  @warning_source
end

Instance Method Details

#authorize_with(&block) ⇒ Object

Allow custom authorization logic



30
31
32
# File 'lib/newshound/configuration.rb', line 30

def authorize_with(&block)
  @authorization_block = block
end

#valid?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/newshound/configuration.rb', line 34

def valid?
  enabled
end