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.2.5 lib/arql/commands/models.rb
arql-0.2.4 lib/arql/commands/models.rb
arql-0.2.3 lib/arql/commands/models.rb
arql-0.2.2 lib/arql/commands/models.rb
arql-0.2.1 lib/arql/commands/models.rb
arql-0.2.0 lib/arql/commands/models.rb
arql-0.1.33 lib/arql/commands/models.rb
arql-0.1.32 lib/arql/commands/models.rb
arql-0.1.31 lib/arql/commands/models.rb
arql-0.1.30 lib/arql/commands/models.rb
arql-0.1.29 lib/arql/commands/models.rb
arql-0.1.28 lib/arql/commands/models.rb
arql-0.1.27 lib/arql/commands/models.rb
arql-0.1.26 lib/arql/commands/models.rb
arql-0.1.25 lib/arql/commands/models.rb
arql-0.1.24 lib/arql/commands/models.rb
arql-0.1.23 lib/arql/commands/models.rb
arql-0.1.22 lib/arql/commands/models.rb
arql-0.1.21 lib/arql/commands/models.rb
arql-0.1.20 lib/arql/commands/models.rb