Class: ExpressAdmin::Components::Presenters::SmartTable::Column

Inherits:
Object
  • Object
show all
Defined in:
app/components/express_admin/smart_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(accessor, title = nil) ⇒ Column

Returns a new instance of Column.



230
231
232
233
234
235
# File 'app/components/express_admin/smart_table.rb', line 230

def initialize(accessor, title = nil)
  @name = accessor.kind_of?(Symbol) ? accessor.to_s.underscore : title.titleize.gsub(/\s+/,'').underscore
  @accessor = accessor
  @title = title || @name.titleize
  @table_column = table_column
end

Instance Attribute Details

#accessor ⇒ Object (readonly)

Returns the value of attribute accessor.



229
230
231
# File 'app/components/express_admin/smart_table.rb', line 229

def accessor
  @accessor
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



229
230
231
# File 'app/components/express_admin/smart_table.rb', line 229

def name
  @name
end

#table_column ⇒ Object (readonly)

Returns the value of attribute table_column.



229
230
231
# File 'app/components/express_admin/smart_table.rb', line 229

def table_column
  @table_column
end

#title ⇒ Object (readonly)

Returns the value of attribute title.



229
230
231
# File 'app/components/express_admin/smart_table.rb', line 229

def title
  @title
end

Instance Method Details

#accessor_match(regex) ⇒ Object



245
246
247
# File 'app/components/express_admin/smart_table.rb', line 245

def accessor_match(regex)
  accessor.to_s.match(regex).try(:[], 1)
end