Class: TableGo::Column

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, name, options = {}, &block) ⇒ Column

Returns a new instance of Column.



5
6
7
# File 'lib/table_go/column.rb', line 5

def initialize(table, name, options = {}, &block)
  @table, @name, @options, @block = table, name, options, block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



3
4
5
# File 'lib/table_go/column.rb', line 3

def block
  @block
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/table_go/column.rb', line 3

def name
  @name
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/table_go/column.rb', line 3

def options
  @options
end

#tableObject

Returns the value of attribute table.



3
4
5
# File 'lib/table_go/column.rb', line 3

def table
  @table
end

Instance Method Details

#asObject



13
14
15
# File 'lib/table_go/column.rb', line 13

def as
  options[:as]
end

#as_optionsObject



21
22
23
# File 'lib/table_go/column.rb', line 21

def as_options
  options[:as_options] || {}
end

#column_htmlObject



29
30
31
# File 'lib/table_go/column.rb', line 29

def column_html
  options[:column_html]
end

#header_htmlObject



25
26
27
# File 'lib/table_go/column.rb', line 25

def header_html
  options[:header_html]
end

#human_attribute_nameObject



37
38
39
40
41
42
43
# File 'lib/table_go/column.rb', line 37

def human_attribute_name
  if table.model_klass.respond_to?(:human_attribute_name) # using rails default I18n
    table.model_klass.human_attribute_name(name).html_safe
  else
    name.to_s.humanize
  end
end

#labelObject



9
10
11
# File 'lib/table_go/column.rb', line 9

def label
  options[:label]
end

#methodObject



33
34
35
# File 'lib/table_go/column.rb', line 33

def method
  options[:method]
end

#sendObject



17
18
19
# File 'lib/table_go/column.rb', line 17

def send
  options[:send]
end