Sha256: 617a7574a029f24c3592b81ee69e024c9b2794486b7e738294968b759e7d95c2

Contents?: true

Size: 647 Bytes

Versions: 74

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

74 entries across 74 versions & 1 rubygems

Version Path
arql-0.3.21 lib/arql/commands/show_sql.rb
arql-0.3.20 lib/arql/commands/show_sql.rb
arql-0.3.19 lib/arql/commands/show_sql.rb
arql-0.3.18 lib/arql/commands/show_sql.rb
arql-0.3.17 lib/arql/commands/show_sql.rb
arql-0.3.16 lib/arql/commands/show_sql.rb
arql-0.3.15 lib/arql/commands/show_sql.rb
arql-0.3.14 lib/arql/commands/show_sql.rb
arql-0.3.13 lib/arql/commands/show_sql.rb
arql-0.3.12 lib/arql/commands/show_sql.rb
arql-0.3.11 lib/arql/commands/show_sql.rb
arql-0.3.10 lib/arql/commands/show_sql.rb
arql-0.3.9 lib/arql/commands/show_sql.rb
arql-0.3.8 lib/arql/commands/show_sql.rb
arql-0.3.7 lib/arql/commands/show_sql.rb
arql-0.3.6 lib/arql/commands/show_sql.rb
arql-0.3.5 lib/arql/commands/show_sql.rb
arql-0.3.3 lib/arql/commands/show_sql.rb
arql-0.3.2 lib/arql/commands/show_sql.rb
arql-0.3.1 lib/arql/commands/show_sql.rb