Class: TableHelpers::BooleanFormatter

Inherits:
SimpleFormatter show all
Defined in:
app/utils/table_helpers.rb

Instance Method Summary collapse

Instance Method Details

#alignObject



34
35
36
# File 'app/utils/table_helpers.rb', line 34

def align
  :center
end

#format_value(item, format) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/utils/table_helpers.rb', line 16

def format_value(item, format)
  case format
    when Proc
      format.call(item)
    when String
      item ? format : ''
    when Hash
      case item
        when true
          format[:true].presence || format[:yes].presence || ''
        else
          format[:false].presence || format[:no].presence || ''
      end
    else
      item ? '<i class="glyphicon glyphicon-check"></i>'.html_safe : ''
  end
end