Class: TableSettings::DetailTable

Inherits:
Object
  • Object
show all
Defined in:
lib/table_settings/detail_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDetailTable

Returns a new instance of DetailTable.



5
6
7
8
9
10
11
12
13
# File 'lib/table_settings/detail_table.rb', line 5

def initialize
  @hash = {
      :only => [],
      :except => [],
      :global_format_method => {},
      :show_timestamps => false,
      :show_id => false
          }
end

Instance Attribute Details

#hashHash (readonly)

Returns:

  • (Hash)


16
17
18
# File 'lib/table_settings/detail_table.rb', line 16

def hash
  @hash
end

Instance Method Details

#add(column) ⇒ Object



23
24
25
26
# File 'lib/table_settings/detail_table.rb', line 23

def add(column)
  @hash[:only] << column
  self
end

#caption(name) ⇒ Object



48
49
50
51
# File 'lib/table_settings/detail_table.rb', line 48

def caption(name)
  @hash[:caption] = caption
  self
end

#class_name(name) ⇒ Object



43
44
45
46
# File 'lib/table_settings/detail_table.rb', line 43

def class_name(name)
  @hash[:class_name] = name
  self
end

#css_class(name) ⇒ Object



62
63
64
65
# File 'lib/table_settings/detail_table.rb', line 62

def css_class(name)
  @hash[:class] = name
  self
end

#css_id(id) ⇒ Object



58
59
60
61
# File 'lib/table_settings/detail_table.rb', line 58

def css_id(id)
  @hash[:id] = id
  self
end

#exclude(column) ⇒ Object



28
29
30
31
# File 'lib/table_settings/detail_table.rb', line 28

def exclude(column)
  @hash[:except] << column
  self
end

#global_format_method(col_name, fnc_name) ⇒ Object



53
54
55
56
# File 'lib/table_settings/detail_table.rb', line 53

def global_format_method(col_name, fnc_name)
  @hash[:global_format_method][col_name] = fnc_name
  self
end

#show_id(boolean) ⇒ Object



38
39
40
41
# File 'lib/table_settings/detail_table.rb', line 38

def show_id(boolean)
  @hash[:show_id] = boolean
  self
end

#show_timestamps(boolean) ⇒ Object



33
34
35
36
# File 'lib/table_settings/detail_table.rb', line 33

def show_timestamps(boolean)
  @hash[:show_timestamps] = boolean
  self
end