Sha256: b2b561e70b8f342878204ffdfb68312e99e395994c63410cddad252a8a1f1acf

Contents?: true

Size: 658 Bytes

Versions: 6

Compression:

Stored size: 658 Bytes

Contents

module PgBouncerHero
  module ApplicationHelper
    def is_active(action_name)
      params[:action] == action_name ? 'active' : nil
    end
    def alert_class_for(flash_type)
      case flash_type
      when 'success'
        'success'
      when 'error'
        'error'
      when 'notice'
        'info'
      when 'warning'
        'warning'
      else
        nil
      end
    end
    def humanize_ms(millis)
      [[1000, :ms], [60, :s], [60, :min], [24, :h], [1000, :d]].map{ |count, name|
        if millis > 0
          millis, n = millis.divmod(count)
          "#{n.to_i} #{name}"
        end
      }.compact.reverse.join(' ')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pgbouncerhero-2.0.0 app/helpers/pg_bouncer_hero/application_helper.rb
pgbouncerhero-1.0.3 app/helpers/pg_bouncer_hero/application_helper.rb
pgbouncerhero-1.0.1 app/helpers/pg_bouncer_hero/application_helper.rb
pgbouncerhero-1.0.0 app/helpers/pg_bouncer_hero/application_helper.rb
pgbouncerhero-0.1.1 app/helpers/pg_bouncer_hero/application_helper.rb
pgbouncerhero-0.1.0 app/helpers/pg_bouncer_hero/application_helper.rb