Class: DatabaseRecorder::Config
- Inherits:
-
Object
- Object
- DatabaseRecorder::Config
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/database_recorder/config.rb
Constant Summary collapse
- DEFAULT_DB_DRIVER =
:active_record
- DEFAULT_STORAGE =
DatabaseRecorder::Storage::File
- DB_DRIVER_VALUES =
%i[active_record mysql2 pg].freeze
- PRINT_QUERIES_VALUES =
[false, true, :color].freeze
- STORAGE_VALUES =
{ file: DatabaseRecorder::Storage::File, redis: DatabaseRecorder::Storage::Redis }.freeze
Instance Attribute Summary collapse
-
#db_driver ⇒ Object
Returns the value of attribute db_driver.
-
#print_queries ⇒ Object
Returns the value of attribute print_queries.
-
#replay_recordings ⇒ Object
Returns the value of attribute replay_recordings.
-
#storage ⇒ Object
Returns the value of attribute storage.
Class Method Summary collapse
- .db_driver=(value) ⇒ Object
- .load_defaults ⇒ Object
- .print_queries=(value) ⇒ Object
- .storage=(value) ⇒ Object
Instance Attribute Details
#db_driver ⇒ Object
Returns the value of attribute db_driver.
20 21 22 |
# File 'lib/database_recorder/config.rb', line 20 def db_driver @db_driver end |
#print_queries ⇒ Object
Returns the value of attribute print_queries.
20 21 22 |
# File 'lib/database_recorder/config.rb', line 20 def print_queries @print_queries end |
#replay_recordings ⇒ Object
Returns the value of attribute replay_recordings.
20 21 22 |
# File 'lib/database_recorder/config.rb', line 20 def replay_recordings @replay_recordings end |
#storage ⇒ Object
Returns the value of attribute storage.
20 21 22 |
# File 'lib/database_recorder/config.rb', line 20 def storage @storage end |
Class Method Details
.db_driver=(value) ⇒ Object
34 35 36 |
# File 'lib/database_recorder/config.rb', line 34 def db_driver=(value) instance.db_driver = DB_DRIVER_VALUES.include?(value) ? value : DEFAULT_DB_DRIVER end |
.load_defaults ⇒ Object
27 28 29 30 31 32 |
# File 'lib/database_recorder/config.rb', line 27 def load_defaults instance.db_driver = DEFAULT_DB_DRIVER instance.print_queries = false instance.replay_recordings = false instance.storage = DEFAULT_STORAGE end |
.print_queries=(value) ⇒ Object
38 39 40 |
# File 'lib/database_recorder/config.rb', line 38 def print_queries=(value) instance.print_queries = PRINT_QUERIES_VALUES.include?(value) ? value : false end |
.storage=(value) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/database_recorder/config.rb', line 42 def storage=(value) instance.storage = if value.is_a?(Class) && value < Storage::Base value else STORAGE_VALUES[value] end end |