Class: TableInspector::Presenter::Postgresql

Inherits:
TableInspector::Presenter show all
Defined in:
lib/table_inspector/presenter/postgresql.rb

Instance Attribute Summary

Attributes inherited from TableInspector::Presenter

#klass, #option

Instance Method Summary collapse

Methods inherited from TableInspector::Presenter

current, #extract_meta, #headings, #initialize

Constructor Details

This class inherits a constructor from TableInspector::Presenter

Instance Method Details

#extract_meta_without_highlight(column) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/table_inspector/presenter/postgresql.rb', line 3

def extract_meta_without_highlight(column)
  column.as_json.merge(column..as_json).slice(*ordered_keys).tap do |column_data|
    column_data["default"] = case column_data["type"]
                             when "string"
                               column_data["default"]&.inspect
                             when "boolean"
                               { "true" => true, "false" => false }[column_data["default"]]
                             else
                               column_data["default"]
                             end
  end
end