Module: Dbhero::Configuration
- Included in:
- Dbhero
- Defined in:
- lib/dbhero/configuration.rb
Constant Summary collapse
- VALID_CONFIG_KEYS =
[:authenticate, :current_user_method, :custom_user_auth_condition, :csv_delimiter, :user_representation, :google_api_id, :google_api_secret, :max_rows_limit].freeze
- DEFAULT_AUTHENTICATE =
true
- DEFAULT_CURRENT_USER_METHOD =
:current_user
- DEFAULT_GOOGLE_API_ID =
''
- DEFAULT_GOOGLE_API_SECRET =
''
- DEFAULT_USER_PRESENTATION =
:email
- DEFAULT_CUSTOM_USER_AUTH_CONDITION =
nil
- DEFAULT_MAX_ROWS_LIMIT =
10_000
- DEFAULT_CSV_DELIMITER =
','
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
17 18 19 |
# File 'lib/dbhero/configuration.rb', line 17 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
21 22 23 |
# File 'lib/dbhero/configuration.rb', line 21 def configure yield self if block_given? end |
#options ⇒ Object
25 26 27 |
# File 'lib/dbhero/configuration.rb', line 25 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dbhero/configuration.rb', line 29 def reset self.authenticate = DEFAULT_AUTHENTICATE self.current_user_method = DEFAULT_CURRENT_USER_METHOD self.user_representation = DEFAULT_USER_PRESENTATION self.google_api_id = DEFAULT_GOOGLE_API_ID self.google_api_secret = DEFAULT_GOOGLE_API_SECRET self.custom_user_auth_condition = DEFAULT_CUSTOM_USER_AUTH_CONDITION self.max_rows_limit = DEFAULT_MAX_ROWS_LIMIT self.csv_delimiter = DEFAULT_CSV_DELIMITER end |