Class: TableHelper::Column

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

Overview

:nodoc:

Direct Known Subclasses

CallbackColumn, SimpleColumn

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, obj, ops) ⇒ Column

Returns a new instance of Column.



6
7
8
9
10
# File 'lib/table_for/column.rb', line 6

def initialize(template, obj, ops)
  @template, @attr, @options = template, obj, ops
  @title = @options.delete(:title) || @attr.to_s.humanize.presence || " "
  @html  = @options.delete(:html)  || {}
end

Instance Attribute Details

#htmlObject (readonly)

Returns the value of attribute html.



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

def html
  @html
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#content_forObject

Raises:

  • (NoMethodError)


12
13
14
# File 'lib/table_for/column.rb', line 12

def content_for
  raise NoMethodError, "Use SimpleColumn or CallbackColumn"
end

#draw_titleObject



16
17
18
19
20
# File 'lib/table_for/column.rb', line 16

def draw_title
   :th, @html[:th] do
    @title
  end
end