Module: TableInspector

Extended by:
TableInspector
Included in:
TableInspector
Defined in:
lib/table_inspector.rb,
lib/table_inspector/text.rb,
lib/table_inspector/table.rb,
lib/table_inspector/column.rb,
lib/table_inspector/indexes.rb,
lib/table_inspector/railtie.rb,
lib/table_inspector/version.rb,
lib/table_inspector/presenter.rb,
lib/table_inspector/inspectable.rb,
lib/table_inspector/terminal_table.rb,
lib/table_inspector/model_validator.rb,
lib/table_inspector/column_validator.rb,
lib/table_inspector/presenter_option.rb

Defined Under Namespace

Modules: Inspectable, Text Classes: Column, ColumnValidator, Indexes, ModelValidator, Presenter, PresenterOption, Railtie, Table, TerminalTable

Constant Summary collapse

VERSION =
"1.0.0"

Instance Method Summary collapse

Instance Method Details

#ascan(klass, column_name = nil, **options) ⇒ Object

options:

- sql_type: pass "true" print sql type, pass "false" not print sql type, default is false
- comment_only: pass "true" print comment only, pass "false" will print all column info, default is false


25
26
27
# File 'lib/table_inspector.rb', line 25

def ascan(klass, column_name = nil, **options)
  scan(klass, column_name, colorize: true, **options)
end

#scan(klass, column_name = nil, colorize: false, **options) ⇒ Object

options:

- sql_type: pass "true" print sql type, pass "false" not print sql type, default is false
- comment_only: pass "true" print comment only, pass "false" will print all column info, default is false
- colorize: pass "true" print colorful scheme, pass "false" will print scheme without color, default is false


33
34
35
36
37
38
39
40
41
# File 'lib/table_inspector.rb', line 33

def scan(klass, column_name = nil, colorize: false, **options)
  klass = classify!(klass)

  return unless klass
  return unless validate!(klass, column_name)

  presenter_options = PresenterOption.new({ **options, colorize: colorize })
  render(klass, column_name, presenter_options)
end