module Arql::Commands::Models

Public Class Methods

models() click to toggle source
# File lib/arql/commands/models.rb, line 6
def models
  t = []
  t << ['Table Name', 'Model Class', 'Abbr', 'Comment']
  t << nil
  Arql::Definition.models.each do |definition|
    t << [definition[:table], definition[:model].name, definition[:abbr] || '', definition[:comment] || '']
  end
  t
end
models_table(regexp) click to toggle source
# File lib/arql/commands/models.rb, line 16
def models_table(regexp)
  Terminal::Table.new do |t|
    models.each_with_index { |row, idx| t << (row || :separator) if row.nil? ||
      regexp.nil? ||
      idx.zero? ||
      row.any? { |e| e =~ regexp }
    }
  end
end