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, :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
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
16 17 18 |
# File 'lib/dbhero/configuration.rb', line 16 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
20 21 22 |
# File 'lib/dbhero/configuration.rb', line 20 def configure yield self if block_given? end |
#options ⇒ Object
24 25 26 |
# File 'lib/dbhero/configuration.rb', line 24 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/dbhero/configuration.rb', line 28 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 end |