Class: ActiveList::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/active-list/definition.rb

Direct Known Subclasses

ActionColumn, DataColumn, FieldColumn

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Column.



67
68
69
70
71
72
73
# File 'lib/active-list/definition.rb', line 67

def initialize(table, name, options={})
  @table   = table
  @name    = name
  @options = options
  @column  = @table.model.columns.detect{|c| c.name.to_s == @name.to_s }
  @id = @table.new_id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



65
66
67
# File 'lib/active-list/definition.rb', line 65

def id
  @id
end

#nameObject

Returns the value of attribute name.



64
65
66
# File 'lib/active-list/definition.rb', line 64

def name
  @name
end

#optionsObject

Returns the value of attribute options.



64
65
66
# File 'lib/active-list/definition.rb', line 64

def options
  @options
end

#tableObject

Returns the value of attribute table.



64
65
66
# File 'lib/active-list/definition.rb', line 64

def table
  @table
end

Instance Method Details

#exportable?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/active-list/definition.rb', line 83

def exportable?
  false
end

#header_codeObject

Raises:

  • (NotImplementedError)


75
76
77
# File 'lib/active-list/definition.rb', line 75

def header_code
  raise NotImplementedError.new("#{self.class.name}#header_code is not implemented.")
end

#simple_idObject

Uncommon but simple identifier for CSS class uses



93
94
95
# File 'lib/active-list/definition.rb', line 93

def simple_id
  "_#{@table.id}_#{@id}"
end

#sortable?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/active-list/definition.rb', line 79

def sortable?
  false
end

#unique_idObject

Unique identifier of the column in the application



88
89
90
# File 'lib/active-list/definition.rb', line 88

def unique_id
  "#{@table.name}-#{@id}"
end