Sha256: 24f2ecbd4cadb856d33abb8de900a56e994de5261ad498bd02f88b2a895d36e7

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

module Enumerable
  def with_fortschritt(opts = {})
    Fortschritt.init(size, opts)
    self
  end
end

class Object
  def fortschritt
    Fortschritt.increment
    self
  end
end

if defined?(Rails)
  module Fortschritt::ActiveRecordExtension

    extend ActiveSupport::Concern

    # Silence fortschritt in tests and in non-terminal context
    def with_fortschritt(opts = {})
      unless opts.has_key?(:silent)
        opts[:silent] = Rails.env.test? || !STDOUT.tty?
      end
      Fortschritt.init(size, opts)
      self
    end
  end

  ActiveRecord::Relation.send(:include, Fortschritt::ActiveRecordExtension)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fortschritt-0.2.5 lib/fortschritt/enumerable.rb