class Acclimate::Formatter::EntityTable

Public Instance Methods

render() click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 5
def render
  renderred
end

Protected Instance Methods

attributes() click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 46
def attributes
  raise NotImplementedError
end
col_width() click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 50
def col_width
  @col_width ||= attributes.map( &:size ).max + 0
end
label_column_options() click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 28
def label_column_options
  {
    align: 'right',
    color: :cyan,
    width: col_width
  }
end
label_column_value( attr ) click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 24
def label_column_value( attr )
  attr
end
renderred() click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 11
def renderred
  @renderred ||= capture do
    table do
      attributes.each do |attr|
        row do
          column label_column_value( attr ), label_column_options
          column val_column_value( attr ),   val_column_options
        end
      end
    end
  end
end
val_column_options() click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 40
def val_column_options
  {
    width: 50
  }
end
val_column_value( attr ) click to toggle source
# File lib/acclimate/formatter/entity_table.rb, line 36
def val_column_value( attr )
  send( attr )
end