Class: Datagrid::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/datagrid/configuration.rb

Overview

Configuration

Datagrid provides several configuration options.

Here is the API reference and a description of the available options:

Datagrid.configure do |config|
  # Defines date formats that can be used to parse dates.
  # Note: Multiple formats can be specified. The first format is used to format dates as strings,
  # while other formats are used only for parsing dates
  # from strings (e.g., if your app supports multiple formats).
  config.date_formats = "%m/%d/%Y", "%Y-%m-%d"

  # Defines timestamp formats that can be used to parse timestamps.
  # Note: Multiple formats can be specified. The first format is used to format timestamps as strings,
  # while other formats are used only for parsing timestamps
  # from strings (e.g., if your app supports multiple formats).
  config.datetime_formats = ["%m/%d/%Y %h:%M", "%Y-%m-%d %h:%M:%s"]
end

These options can be set globally in your application to customize Datagrid’s behavior.

Instance Attribute Summary collapse

Instance Attribute Details

#date_formatsArray<String>

Returns Date parsing formats.

Returns:

  • (Array<String>)

    Date parsing formats



43
44
45
# File 'lib/datagrid/configuration.rb', line 43

def date_formats
  @date_formats
end

#datetime_formatsArray<String>

Returns Timestamp parsing formats.

Returns:

  • (Array<String>)

    Timestamp parsing formats



45
46
47
# File 'lib/datagrid/configuration.rb', line 45

def datetime_formats
  @datetime_formats
end