Module: Arql::Commands::Models

Defined in:
lib/arql/commands/models.rb

Class Method Summary collapse

Class Method Details

.modelsObject



6
7
8
9
10
11
12
13
14
# 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) ⇒ Object



16
17
18
19
20
21
22
23
24
# 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