Sha256: 99ea6b97141b07db1c95dc4feaa3a01356fe395d3c7085ad745695421092fba4

Contents?: true

Size: 602 Bytes

Versions: 35

Compression:

Stored size: 602 Bytes

Contents

def with_date_format(format = "%m/%d/%Y")
  begin
    old_format = Datagrid.configuration.date_formats
    Datagrid.configure do |config|
      config.date_formats = format
    end
    yield
  ensure
    Datagrid.configure do |config|
      config.date_formats = old_format
    end
  end
end

def with_datetime_format(format = "%m/%d/%Y")
  begin
    old_format = Datagrid.configuration.datetime_formats
    Datagrid.configure do |config|
      config.datetime_formats = format
    end
    yield
  ensure
    Datagrid.configure do |config|
      config.datetime_formats = old_format
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
datagrid-1.6.1 spec/support/configuration.rb
datagrid-1.6.0 spec/support/configuration.rb
datagrid-1.5.9 spec/support/configuration.rb
datagrid-1.5.8 spec/support/configuration.rb
datagrid-1.5.7 spec/support/configuration.rb
datagrid-1.5.6 spec/support/configuration.rb
datagrid-1.5.5 spec/support/configuration.rb
datagrid-1.5.4 spec/support/configuration.rb
datagrid-1.5.3 spec/support/configuration.rb
datagrid-1.5.2 spec/support/configuration.rb
datagrid-1.5.1 spec/support/configuration.rb
datagrid-1.5.0 spec/support/configuration.rb
datagrid-1.4.4 spec/support/configuration.rb
datagrid-1.4.3 spec/support/configuration.rb
datagrid-1.4.2 spec/support/configuration.rb
datagrid-1.4.1 spec/support/configuration.rb
datagrid-1.4.0 spec/support/configuration.rb
datagrid-1.3.9 spec/support/configuration.rb
datagrid-1.3.7 spec/support/configuration.rb
datagrid-1.3.6 spec/support/configuration.rb