Class: Redde::IndexHelper::IndexBuilder::IndexHeadCellBuilder

Inherits:
Object
  • Object
show all
Includes:
ActionView::Context, ActionView::Helpers::TagHelper
Defined in:
app/helpers/redde/index_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list) ⇒ IndexHeadCellBuilder

Returns a new instance of IndexHeadCellBuilder.



170
171
172
# File 'app/helpers/redde/index_helper.rb', line 170

def initialize(list)
  @list = list
end

Instance Attribute Details

#listObject

Returns the value of attribute list.



168
169
170
# File 'app/helpers/redde/index_helper.rb', line 168

def list
  @list
end

Instance Method Details

#cell(field = nil, options = {}, &block) ⇒ Object



174
175
176
177
178
179
180
181
182
# File 'app/helpers/redde/index_helper.rb', line 174

def cell field = nil, options = {}, &block
  if field.is_a?(Symbol) || field.is_a?(String)
     :th, list.human_attribute_name(field), class: ['list__head', options[:class]]
  elsif field.is_a?(Hash)
     :th, "", class: ['list__head', field[:class]]
  elsif field.nil?
     :th, "", class: 'list__head'
  end
end