Sha256: b31c560d43946af8c0a3b697681960159dfc672c3fca48945b99d4a1a3d83ea5

Contents?: true

Size: 734 Bytes

Versions: 29

Compression:

Stored size: 734 Bytes

Contents

require 'terminal-table'

module Arql::Commands
  module Models
    class << self
      def models
        t = []
        t << ['Table Name', 'Model Class', 'Abbr']
        t << nil
        Arql::Definition.models.each do |definition|
          t << [definition[:table], definition[:model].name, definition[:abbr] || '']
        end
        t
      end

      def models_table
        Terminal::Table.new do |t|
          models.each { |row| t << (row || :separator) }
        end
      end
    end
  end

  Pry.commands.block_command 'm' do
    puts
    puts Models::models_table
  end

  Pry.commands.alias_command 'l', 'm'
end

module Kernel
  def models
    Arql::Commands::Models::models
  end

  def tables
    models
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
arql-0.1.19 lib/arql/commands/models.rb
arql-0.1.18 lib/arql/commands/models.rb
arql-0.1.17 lib/arql/commands/models.rb
arql-0.1.16 lib/arql/commands/models.rb
arql-0.1.15 lib/arql/commands/models.rb
arql-0.1.14 lib/arql/commands/models.rb
arql-0.1.13 lib/arql/commands/models.rb
arql-0.1.12 lib/arql/commands/models.rb
arql-0.1.11 lib/arql/commands/models.rb