Class: DatatablesRecordsMapper::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/datatables_records_mapper/mapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, params, mapper, options = {}) ⇒ Mapper

Returns a new instance of Mapper.



3
4
5
6
7
8
# File 'lib/datatables_records_mapper/mapper.rb', line 3

def initialize(model, params, mapper, options = {})
  @model = model
  @params = params
  @mapper = mapper
  @options = options
end

Instance Method Details

#mapped_recordsObject



10
11
12
13
# File 'lib/datatables_records_mapper/mapper.rb', line 10

def mapped_records
  records['data'] = records['data'].map { |r| @mapper.map(r) }
  records
end