Class: TableMe::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/table_me/column.rb

Overview

This class is the column object that gets created everytime a column is used in the table_for_presenter block It’s basically a value object which keeps track of the data for each individual column.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column_name, args = {}, &block) ⇒ Column

Returns a new instance of Column.



8
9
10
11
12
13
14
15
16
17
# File 'lib/table_me/column.rb', line 8

def initialize column_name, args = {}, &block
  self.name = column_name
  self.content = block
  
  if block
    self.sortable = args[:sort_on]
  else
    self.sortable = column_name
  end
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/table_me/column.rb', line 7

def content
  @content
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/table_me/column.rb', line 7

def name
  @name
end

#sortableObject

Returns the value of attribute sortable.



7
8
9
# File 'lib/table_me/column.rb', line 7

def sortable
  @sortable
end