Class: Niceql::NiceQLConfig
- Inherits:
-
Object
- Object
- Niceql::NiceQLConfig
- Defined in:
- lib/niceql.rb
Instance Attribute Summary collapse
-
#indentation_base ⇒ Object
Returns the value of attribute indentation_base.
-
#open_bracket_is_newliner ⇒ Object
Returns the value of attribute open_bracket_is_newliner.
-
#pg_adapter_with_nicesql ⇒ Object
Returns the value of attribute pg_adapter_with_nicesql.
-
#prettify_active_record_log_output ⇒ Object
Returns the value of attribute prettify_active_record_log_output.
-
#prettify_pg_errors ⇒ Object
Returns the value of attribute prettify_pg_errors.
Instance Method Summary collapse
- #ar_using_pg_adapter? ⇒ Boolean
-
#initialize ⇒ NiceQLConfig
constructor
A new instance of NiceQLConfig.
Constructor Details
#initialize ⇒ NiceQLConfig
Returns a new instance of NiceQLConfig.
268 269 270 271 272 273 274 |
# File 'lib/niceql.rb', line 268 def initialize self.pg_adapter_with_nicesql = false self.indentation_base = 2 self.open_bracket_is_newliner = false self.prettify_active_record_log_output = false self.prettify_pg_errors = ar_using_pg_adapter? end |
Instance Attribute Details
#indentation_base ⇒ Object
Returns the value of attribute indentation_base.
261 262 263 |
# File 'lib/niceql.rb', line 261 def indentation_base @indentation_base end |
#open_bracket_is_newliner ⇒ Object
Returns the value of attribute open_bracket_is_newliner.
261 262 263 |
# File 'lib/niceql.rb', line 261 def open_bracket_is_newliner @open_bracket_is_newliner end |
#pg_adapter_with_nicesql ⇒ Object
Returns the value of attribute pg_adapter_with_nicesql.
261 262 263 |
# File 'lib/niceql.rb', line 261 def pg_adapter_with_nicesql @pg_adapter_with_nicesql end |
#prettify_active_record_log_output ⇒ Object
Returns the value of attribute prettify_active_record_log_output.
261 262 263 |
# File 'lib/niceql.rb', line 261 def prettify_active_record_log_output @prettify_active_record_log_output end |
#prettify_pg_errors ⇒ Object
Returns the value of attribute prettify_pg_errors.
261 262 263 |
# File 'lib/niceql.rb', line 261 def prettify_pg_errors @prettify_pg_errors end |
Instance Method Details
#ar_using_pg_adapter? ⇒ Boolean
252 253 254 255 256 257 258 259 |
# File 'lib/niceql.rb', line 252 def ar_using_pg_adapter? return false unless defined?(::ActiveRecord::Base) adapter = ActiveRecord::Base.try(:connection_db_config).try(:adapter) || ActiveRecord::Base.try(:connection_config)&.with_indifferent_access&.dig(:adapter) adapter == 'postgresql' end |