Module: Tnw::ApplicationHelper

Defined in:
app/helpers/tnw/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#metric_bytes(value) ⇒ Object



9
10
11
12
13
# File 'app/helpers/tnw/application_helper.rb', line 9

def metric_bytes(value)
  return "Unavailable" if value.nil?

  number_to_human_size(value, precision: 3)
end

#metric_decimal(value) ⇒ Object



15
16
17
18
19
# File 'app/helpers/tnw/application_helper.rb', line 15

def metric_decimal(value)
  return "Unavailable" if value.nil?

  number_with_precision(value, precision: 2)
end

#metric_percentage(value) ⇒ Object



3
4
5
6
7
# File 'app/helpers/tnw/application_helper.rb', line 3

def metric_percentage(value)
  return "Unavailable" if value.nil?

  number_to_percentage(value, precision: 1)
end