Class: ActiveDataTables::DataTablesResult
- Inherits:
-
Object
- Object
- ActiveDataTables::DataTablesResult
- Defined in:
- lib/active_data_tables/active_data_tables.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#draw ⇒ Object
Returns the value of attribute draw.
-
#records_filtered ⇒ Object
Returns the value of attribute records_filtered.
-
#records_total ⇒ Object
Returns the value of attribute records_total.
Instance Method Summary collapse
-
#initialize(draw, data, records_total, records_filtered) ⇒ DataTablesResult
constructor
A new instance of DataTablesResult.
- #to_json ⇒ Object
Constructor Details
#initialize(draw, data, records_total, records_filtered) ⇒ DataTablesResult
Returns a new instance of DataTablesResult.
31 32 33 34 35 36 |
# File 'lib/active_data_tables/active_data_tables.rb', line 31 def initialize(draw, data, records_total, records_filtered) @draw = draw @data = data @records_total = records_total @records_filtered = records_filtered end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
29 30 31 |
# File 'lib/active_data_tables/active_data_tables.rb', line 29 def data @data end |
#draw ⇒ Object
Returns the value of attribute draw.
29 30 31 |
# File 'lib/active_data_tables/active_data_tables.rb', line 29 def draw @draw end |
#records_filtered ⇒ Object
Returns the value of attribute records_filtered.
29 30 31 |
# File 'lib/active_data_tables/active_data_tables.rb', line 29 def records_filtered @records_filtered end |
#records_total ⇒ Object
Returns the value of attribute records_total.
29 30 31 |
# File 'lib/active_data_tables/active_data_tables.rb', line 29 def records_total @records_total end |
Instance Method Details
#to_json ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/active_data_tables/active_data_tables.rb', line 38 def to_json data = @data.map do |a| a.is_a?(OpenStruct) ? a.marshal_dump : a end Jbuilder.encode do |json| json.draw @draw json.recordsTotal @records_total json.recordsFiltered @records_filtered json.data data end end |