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.



233
234
235
236
237
238
# File 'app/components/express_admin/smart_table.rb', line 233

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

#accessorObject (readonly)

Returns the value of attribute accessor.



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

def accessor
  @accessor
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#table_columnObject (readonly)

Returns the value of attribute table_column.



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

def table_column
  @table_column
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#accessor_match(regex) ⇒ Object



248
249
250
# File 'app/components/express_admin/smart_table.rb', line 248

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