Sha256: 617a7574a029f24c3592b81ee69e024c9b2794486b7e738294968b759e7d95c2

Contents?: true

Size: 647 Bytes

Versions: 73

Compression:

Stored size: 647 Bytes

Contents

module Arql::Commands
  module ShowSql
    class << self
      def show
        return if Arql::App.log_io.is_a?(Arql::MultiIO) && Arql::App.log_io.include?(STDOUT)
        Arql::App.log_io ||= Arql::MultiIO.new
        ActiveRecord::Base.logger = Logger.new(Arql::App.log_io)
        Arql::App.log_io << STDOUT
      end

      def hide
        return if !Arql::App.log_io.is_a?(Arql::MultiIO) || !Arql::App.log_io.include?(STDOUT)
        Arql::App.log_io.delete(STDOUT)
      end
    end

    Pry.commands.block_command 'show-sql' do
      ShowSql.show
    end

    Pry.commands.block_command 'hide-sql' do
      ShowSql.hide
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
arql-0.2.14 lib/arql/commands/show_sql.rb
arql-0.2.13 lib/arql/commands/show_sql.rb
arql-0.2.12 lib/arql/commands/show_sql.rb
arql-0.2.11 lib/arql/commands/show_sql.rb
arql-0.2.10 lib/arql/commands/show_sql.rb
arql-0.2.9 lib/arql/commands/show_sql.rb
arql-0.2.8 lib/arql/commands/show_sql.rb
arql-0.2.7 lib/arql/commands/show_sql.rb
arql-0.2.6 lib/arql/commands/show_sql.rb
arql-0.2.5 lib/arql/commands/show_sql.rb
arql-0.2.4 lib/arql/commands/show_sql.rb
arql-0.2.3 lib/arql/commands/show_sql.rb
arql-0.2.2 lib/arql/commands/show_sql.rb
arql-0.2.1 lib/arql/commands/show_sql.rb
arql-0.2.0 lib/arql/commands/show_sql.rb
arql-0.1.33 lib/arql/commands/show_sql.rb
arql-0.1.32 lib/arql/commands/show_sql.rb
arql-0.1.31 lib/arql/commands/show_sql.rb
arql-0.1.30 lib/arql/commands/show_sql.rb
arql-0.1.29 lib/arql/commands/show_sql.rb