Class: JSAdmin::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/js_admin/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
# File 'lib/js_admin/configuration.rb', line 12

def initialize
  @included_models = []
  @excluded_models = []
  @records_per_page = 10
  @association_limit = 100
  @display_name_methods = %i[name title email username id]
  @basic_auth_username = nil
  @basic_auth_password = nil
  @basic_auth_realm = "JSAdmin"
end

Instance Attribute Details

#association_limitObject

Returns the value of attribute association_limit.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def association_limit
  @association_limit
end

#basic_auth_passwordObject

Returns the value of attribute basic_auth_password.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def basic_auth_password
  @basic_auth_password
end

#basic_auth_realmObject

Returns the value of attribute basic_auth_realm.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def basic_auth_realm
  @basic_auth_realm
end

#basic_auth_usernameObject

Returns the value of attribute basic_auth_username.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def basic_auth_username
  @basic_auth_username
end

#display_name_methodsObject

Returns the value of attribute display_name_methods.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def display_name_methods
  @display_name_methods
end

#excluded_modelsObject

Returns the value of attribute excluded_models.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def excluded_models
  @excluded_models
end

#included_modelsObject

Returns the value of attribute included_models.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def included_models
  @included_models
end

#records_per_pageObject

Returns the value of attribute records_per_page.



3
4
5
# File 'lib/js_admin/configuration.rb', line 3

def records_per_page
  @records_per_page
end

Instance Method Details

#basic_auth_enabled?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/js_admin/configuration.rb', line 31

def basic_auth_enabled?
  basic_auth_username.to_s != "" && basic_auth_password.to_s != ""
end

#exclude_models(*models) ⇒ Object



27
28
29
# File 'lib/js_admin/configuration.rb', line 27

def exclude_models(*models)
  excluded_models.concat(normalize_model_names(models))
end

#include_models(*models) ⇒ Object



23
24
25
# File 'lib/js_admin/configuration.rb', line 23

def include_models(*models)
  included_models.concat(normalize_model_names(models))
end