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

#hashObject (readonly)

Returns the value of attribute hash.



3
4
5
# File 'lib/table_settings/detail_table.rb', line 3

def hash
  @hash
end

Instance Method Details

#add(column) ⇒ Object



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

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

#caption(name) ⇒ Object



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

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

#class_name(name) ⇒ Object



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

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

#css_class(name) ⇒ Object



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

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

#css_id(id) ⇒ Object



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

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

#exclude(column) ⇒ Object



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

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

#global_format_method(col_name, fnc_name) ⇒ Object



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

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

#show_id(boolean) ⇒ Object



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

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

#show_timestamps(boolean) ⇒ Object



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

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