Class: Activity::ResourceList::BaseFormatter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/services/activity/resource_list.rb

Overview

All Formatters are used to format the display in the select list.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ void

Parameters:

  • record (ActiveRecord::Base)

    the wrapped resource record



250
251
252
253
# File 'app/services/activity/resource_list.rb', line 250

def initialize(record)
  @record = record
  super(@record)
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record.



246
247
248
# File 'app/services/activity/resource_list.rb', line 246

def record
  @record
end

Instance Method Details

#created_atString?

Creation date formatted for the option label.

Returns:

  • (String, nil)


269
270
271
# File 'app/services/activity/resource_list.rb', line 269

def created_at
  record.created_at&.to_fs(:crm_date_only)
end

#displayString

Option label for the select list.

Returns:

  • (String)


257
258
259
# File 'app/services/activity/resource_list.rb', line 257

def display
  record.to_s
end

#identifierString

Option value for the select list: the record's GlobalID.

Returns:

  • (String)


263
264
265
# File 'app/services/activity/resource_list.rb', line 263

def identifier
  record.to_gid.to_s
end

#stateString

Human-readable state for the option label.

Returns:

  • (String)


275
276
277
# File 'app/services/activity/resource_list.rb', line 275

def state
  record.human_state_name
end