trk_datatables 0.2.15 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d7a8767e7c4b77bbdd9d47b478de7b6b3dd456c449e83e50a70c4b674121fa7
4
- data.tar.gz: aedc1d098b6ddd648a7b18fbf99cc88dede84f63a63c7ececa704fcb8bb0d018
3
+ metadata.gz: 3fecf0c6923b35099111fc74976cf13d26087c42e7bb4461f7c91f540c5a2123
4
+ data.tar.gz: 1be013aa2381e6f79fec4c84a2913eb1de087649e971cbfb42b7b4fc8c0e97d8
5
5
  SHA512:
6
- metadata.gz: 890f228e839a1e25ab96db11cf92c2b9a328be57f49e202ad77d2071b2c4ccdec65c31bcb57f5743c3fabbca00cb0f941c9df15364025413a73616e23b906095
7
- data.tar.gz: 9a6744711a901ea792c54633f4eac570a36c9547f8e86f9d112f4ed175d5f7838f33ccb2b33b529cde15f82bd7184edaec881056afb88f183b1df203b8139fa9
6
+ metadata.gz: c8d596f8b8c4ff323ca473d0d10d5cb55c991c815d936765e51ab3144ca08b71e003a01729b3ff112028555ca8fd87488b541278bc358d40e008e554e2b533d6
7
+ data.tar.gz: f8296c711ce5bfed1a6a6aa222dd669bd1b92bf92858a4ab2c31ae544c470d8863172573de21cc3f85514251a356748ad1b24c36f847645cbc7361a2803df2d6
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.1
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in trk_datatables.gemspec
4
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trk_datatables (0.2.15)
4
+ trk_datatables (0.2.16)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -18,6 +18,7 @@ GEM
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
20
  zeitwerk (~> 2.3)
21
+ ast (2.4.2)
21
22
  byebug (11.1.3)
22
23
  concurrent-ruby (1.2.0)
23
24
  database_cleaner (2.0.1)
@@ -28,17 +29,58 @@ GEM
28
29
  database_cleaner-core (2.0.1)
29
30
  i18n (1.12.0)
30
31
  concurrent-ruby (~> 1.0)
32
+ json (2.7.2)
33
+ language_server-protocol (3.17.0.3)
34
+ lint_roller (1.1.0)
31
35
  mini_portile2 (2.8.1)
32
36
  minitest (5.17.0)
33
37
  minitest-color (0.0.2)
34
38
  minitest (~> 5)
39
+ parallel (1.24.0)
40
+ parser (3.3.0.5)
41
+ ast (~> 2.4.1)
42
+ racc
35
43
  pg (1.4.5)
44
+ racc (1.7.3)
45
+ rainbow (3.1.1)
36
46
  rake (10.5.0)
47
+ regexp_parser (2.9.0)
48
+ rexml (3.2.6)
49
+ rubocop (1.62.1)
50
+ json (~> 2.3)
51
+ language_server-protocol (>= 3.17.0)
52
+ parallel (~> 1.10)
53
+ parser (>= 3.3.0.2)
54
+ rainbow (>= 2.2.2, < 4.0)
55
+ regexp_parser (>= 1.8, < 3.0)
56
+ rexml (>= 3.2.5, < 4.0)
57
+ rubocop-ast (>= 1.31.1, < 2.0)
58
+ ruby-progressbar (~> 1.7)
59
+ unicode-display_width (>= 2.4.0, < 3.0)
60
+ rubocop-ast (1.31.2)
61
+ parser (>= 3.3.0.4)
62
+ rubocop-performance (1.20.2)
63
+ rubocop (>= 1.48.1, < 2.0)
64
+ rubocop-ast (>= 1.30.0, < 2.0)
65
+ ruby-progressbar (1.13.0)
37
66
  sqlite3 (1.6.0)
38
67
  mini_portile2 (~> 2.8.0)
68
+ standard (1.35.1)
69
+ language_server-protocol (~> 3.17.0.2)
70
+ lint_roller (~> 1.0)
71
+ rubocop (~> 1.62.0)
72
+ standard-custom (~> 1.0.0)
73
+ standard-performance (~> 1.3)
74
+ standard-custom (1.0.2)
75
+ lint_roller (~> 1.0)
76
+ rubocop (~> 1.50)
77
+ standard-performance (1.3.1)
78
+ lint_roller (~> 1.1)
79
+ rubocop-performance (~> 1.20.2)
39
80
  timecop (0.9.6)
40
81
  tzinfo (2.0.6)
41
82
  concurrent-ruby (~> 1.0)
83
+ unicode-display_width (2.5.0)
42
84
  zeitwerk (2.6.6)
43
85
 
44
86
  PLATFORMS
@@ -54,6 +96,7 @@ DEPENDENCIES
54
96
  pg
55
97
  rake (~> 10.0)
56
98
  sqlite3
99
+ standard
57
100
  timecop
58
101
  trk_datatables!
59
102
 
data/README.md CHANGED
@@ -372,11 +372,11 @@ use empty column_key
372
372
  ```
373
373
 
374
374
  If you have more columns that are not actually columns in database (for example
375
- links or Ruby calculated values) than you can not use empty column_key since
376
- there could be only one (keys in the hash should be unique). When you disable
377
- `order` and `search` than you can use any column name since that column will not
378
- be used in queries. For example column key `posts.body_size` is not in database
379
- nor in Ruby code.
375
+ links or Ruby calculated in ruby values) than you can not use empty column_key
376
+ since there could be only one (keys in the hash should be unique). When you
377
+ disable `order` and `search` than you can use any column name since that column
378
+ will not be used in queries. For example column key `posts.body_size` is not in
379
+ database nor in Ruby code.
380
380
 
381
381
  ```
382
382
  def columns
@@ -1161,6 +1161,12 @@ Column filtering with dropdowns https://datatables.net/extensions/searchpanes/ex
1161
1161
  Adding graphs https://datatables.net/forums/discussion/comment/123621/#Comment_123621
1162
1162
  https://datatables.net/examples/api/highcharts.html
1163
1163
 
1164
+ Run custom JS on next page or search, for example load tooltip.
1165
+
1166
+
1167
+ Check issue when we use param_set for select_options field since select option
1168
+ does not get selected and next page will show all items instead of only ones
1169
+ with selected field.
1164
1170
 
1165
1171
  ## License
1166
1172
 
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
3
 
4
4
  Rake::TestTask.new(:test) do |t|
5
- t.libs << 'test'
6
- t.libs << 'lib'
7
- t.test_files = FileList['test/**/*_test.rb']
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
8
  end
9
9
 
10
10
  task default: :test
@@ -3,7 +3,7 @@ class <%= @trk_class_name %> < TrkDatatables::ActiveRecord
3
3
  {
4
4
  <% @skip_model || class_name.constantize.columns.each do |column| -%>
5
5
  <% next if %w[created_at updated_at].include? column.name -%>
6
- '<%= table_name %>.<%= column.name %>': {},
6
+ "<%= table_name %>.<%= column.name %>": {},
7
7
  <% end -%>
8
8
  }
9
9
  end
@@ -19,7 +19,7 @@ class <%= @trk_class_name %> < TrkDatatables::ActiveRecord
19
19
  [
20
20
  <% @skip_model || class_name.constantize.columns.each do |column| -%>
21
21
  <% next if %w[created_at updated_at].include? column.name -%>
22
- <% if column.name == 'id' -%>
22
+ <% if column.name == "id" -%>
23
23
  @view.link_to(<%= singular_table_name %>.id, <%= singular_table_name %>),
24
24
  <% else -%>
25
25
  <%= singular_table_name %>.<%= column.name %>,
@@ -2,10 +2,10 @@ module TrkDatatables
2
2
  module Generators
3
3
  class TrkDatatablesGenerator < Rails::Generators::NamedBase
4
4
  # we can call with `rails g trk_datatables` instead of: `rails g trk_datatables:trk_datatables`
5
- namespace 'trk_datatables'
6
- source_root File.expand_path('../templates', __dir__)
5
+ namespace "trk_datatables"
6
+ source_root File.expand_path("../templates", __dir__)
7
7
 
8
- desc 'Generates datatables file for a give NAME'
8
+ desc "Generates datatables file for a give NAME"
9
9
  def create
10
10
  begin
11
11
  class_name.constantize
@@ -18,7 +18,7 @@ module TrkDatatables
18
18
  @trk_file_name = "#{singular_name}_datatable"
19
19
  end
20
20
 
21
- template 'trk_datatable.rb', "app/datatables/#{@trk_file_name}.rb"
21
+ template "trk_datatable.rb", "app/datatables/#{@trk_file_name}.rb"
22
22
 
23
23
  say <<~TEXT
24
24
  ======================================================================
@@ -6,7 +6,7 @@ module TrkDatatables
6
6
  # Global search. All columns are typecasted to string. Search string is
7
7
  # splited by space and "and"-ed.
8
8
  def filter_by_search_all(filtered)
9
- conditions = @dt_params.search_all.split(' ').first(MAX_NUMBER_OF_STRINGS).map do |search_string|
9
+ conditions = @dt_params.search_all.split(" ").first(MAX_NUMBER_OF_STRINGS).map do |search_string|
10
10
  @column_key_options.searchable_and_global_search.map do |column_key_option|
11
11
  _filter_column_as_string column_key_option, search_string
12
12
  end.reduce(:or) # any searchable column is 'or'-ed
@@ -38,8 +38,8 @@ module TrkDatatables
38
38
  filter_column_as_in(column_key_option, search_value)
39
39
  elsif %i[boolean].include?(column_key_option[:column_type_in_db])
40
40
  filter_column_as_boolean(column_key_option, search_value)
41
- elsif %i[date datetime integer float].include?(column_key_option[:column_type_in_db]) && \
42
- search_value.include?(BETWEEN_SEPARATOR)
41
+ elsif %i[date datetime integer float].include?(column_key_option[:column_type_in_db]) &&
42
+ search_value.include?(BETWEEN_SEPARATOR)
43
43
  from, to = search_value.split BETWEEN_SEPARATOR
44
44
  filter_column_as_between(column_key_option, from, to)
45
45
  else
@@ -48,9 +48,9 @@ module TrkDatatables
48
48
  end
49
49
 
50
50
  def _filter_column_as_string(column_key_option, search_value)
51
- search_value.split(' ').first(MAX_NUMBER_OF_STRINGS).map do |search_string|
51
+ search_value.split(" ").first(MAX_NUMBER_OF_STRINGS).map do |search_string|
52
52
  casted_column = ::Arel::Nodes::NamedFunction.new(
53
- 'CAST',
53
+ "CAST",
54
54
  [_arel_column(column_key_option).as(@column_key_options.string_cast)]
55
55
  )
56
56
  casted_column.matches("%#{search_string}%")
@@ -59,9 +59,9 @@ module TrkDatatables
59
59
 
60
60
  def filter_column_as_boolean(column_key_option, search_value)
61
61
  # return true relation in case we ignore
62
- return Arel::Nodes::SqlLiteral.new('1').eq(1) if search_value == 'any'
62
+ return Arel::Nodes::SqlLiteral.new("1").eq(1) if search_value == "any"
63
63
 
64
- _arel_column(column_key_option).eq(search_value == 'true')
64
+ _arel_column(column_key_option).eq(search_value == "true")
65
65
  end
66
66
 
67
67
  def filter_column_as_between(column_key_option, from, to)
@@ -88,8 +88,8 @@ module TrkDatatables
88
88
  parsed_from = from
89
89
  parsed_to = to
90
90
  when :date
91
- parsed_from = _parse_in_zone(from).to_date
92
- parsed_to = _parse_in_zone(to).to_date
91
+ parsed_from = _parse_in_zone(from)&.to_date
92
+ parsed_to = _parse_in_zone(to)&.to_date&.end_of_day
93
93
  when :datetime
94
94
  parsed_from = _parse_in_zone(from)
95
95
  parsed_to = _parse_in_zone(to)
@@ -112,8 +112,7 @@ module TrkDatatables
112
112
 
113
113
  def order_and_paginate_items(filtered)
114
114
  filtered = order_items filtered
115
- filtered = filtered.offset(@dt_params.dt_offset).limit(dt_per_page_or_default)
116
- filtered
115
+ filtered.offset(@dt_params.dt_offset).limit(dt_per_page_or_default)
117
116
  end
118
117
 
119
118
  def order_items(filtered)
@@ -122,12 +121,12 @@ module TrkDatatables
122
121
  next if column_key_option[:column_options][ColumnKeyOptions::ORDER_OPTION] == false
123
122
 
124
123
  queries << if column_key_option[:table_class] < TrkDatatables::CalculatedInDb
125
- "#{send(column_key_option[:column_key])} #{direction}"
126
- else
127
- "#{column_key_option[:column_key]} #{direction}"
128
- end
124
+ "#{send(column_key_option[:column_key])} #{direction}"
125
+ else
126
+ "#{column_key_option[:column_key]} #{direction}"
127
+ end
129
128
  end
130
- filtered.order(Arel.sql(order_by.join(', ')))
129
+ filtered.order(Arel.sql(order_by.join(", ")))
131
130
  end
132
131
 
133
132
  def _arel_column(column_key_option)
@@ -1,7 +1,7 @@
1
1
  module TrkDatatables
2
2
  # TODO: extract those to configuration options
3
- BETWEEN_SEPARATOR = ' - '.freeze
4
- MULTIPLE_OPTION_SEPARATOR = '|'.freeze
3
+ BETWEEN_SEPARATOR = " - ".freeze
4
+ MULTIPLE_OPTION_SEPARATOR = "|".freeze
5
5
  # maximum page length = 100 (we should not believe params)
6
6
 
7
7
  class Error < StandardError
@@ -85,16 +85,16 @@ module TrkDatatables
85
85
  end
86
86
 
87
87
  def filter_by_search_all(_all)
88
- raise 'filter_by_columns_is_defined_in_specific_orm'
88
+ raise "filter_by_columns_is_defined_in_specific_orm"
89
89
  end
90
90
 
91
91
  def filter_by_columns(_all)
92
- raise 'filter_by_columns_is_defined_in_specific_orm' \
92
+ raise "filter_by_columns_is_defined_in_specific_orm" \
93
93
  "\n Extent from TrkDatatables::ActiveRecord instead of TrkDatatables::Base"
94
94
  end
95
95
 
96
96
  def order_and_paginate_items(_filtered_items)
97
- raise 'order_and_paginate_items_is_defined_in_specific_orm'
97
+ raise "order_and_paginate_items_is_defined_in_specific_orm"
98
98
  end
99
99
 
100
100
  # Returns dt_orders or default as array of index and direction
@@ -112,7 +112,9 @@ module TrkDatatables
112
112
  @dt_orders_or_default = @dt_params.dt_orders
113
113
  @preferences.set :order, @dt_params.dt_orders
114
114
  else
115
- check_value = ->(r) { r.is_a?(Array) && r[0].is_a?(Array) && r[0][0].is_a?(Integer) && r[0][0] < @column_key_options.size }
115
+ check_value = lambda { |r|
116
+ r.is_a?(Array) && r[0].is_a?(Array) && r[0][0].is_a?(Integer) && r[0][0] < @column_key_options.size
117
+ }
116
118
  @dt_orders_or_default = @preferences.get(:order, check_value) || default_order
117
119
  end
118
120
  @dt_orders_or_default
@@ -129,7 +131,7 @@ module TrkDatatables
129
131
  def dt_per_page_or_default
130
132
  return @dt_per_page_or_default if defined? @dt_per_page_or_default
131
133
 
132
- @dt_per_page_or_default = \
134
+ @dt_per_page_or_default =
133
135
  if @dt_params.dt_per_page.present?
134
136
  @preferences.set :per_page, @dt_params.dt_per_page
135
137
  @dt_params.dt_per_page
@@ -216,31 +218,31 @@ module TrkDatatables
216
218
  end
217
219
 
218
220
  def predefined_ranges
219
- Time.zone ||= 'UTC'
221
+ Time.zone ||= "UTC"
220
222
  {
221
223
  date: predefined_date_ranges,
222
- datetime: predefined_datetime_ranges,
224
+ datetime: predefined_datetime_ranges
223
225
  }
224
226
  end
225
227
 
226
228
  def predefined_date_ranges # rubocop:todo Metrics/AbcSize
227
229
  {
228
- 'Today': Time.zone.today..Time.zone.today,
229
- 'Yesterday': [Time.zone.today - 1.day, Time.zone.today - 1.day],
230
- 'This Month': Time.zone.today.beginning_of_month...Time.zone.today,
231
- 'Last Month': Time.zone.today.prev_month.beginning_of_month...Time.zone.today.prev_month.end_of_month,
232
- 'This Year': Time.zone.today.beginning_of_year...Time.zone.today,
230
+ Today: Time.zone.today..Time.zone.today,
231
+ Yesterday: [Time.zone.today - 1.day, Time.zone.today - 1.day],
232
+ "This Month": Time.zone.today.beginning_of_month...Time.zone.today,
233
+ "Last Month": Time.zone.today.prev_month.beginning_of_month...Time.zone.today.prev_month.end_of_month,
234
+ "This Year": Time.zone.today.beginning_of_year...Time.zone.today
233
235
  }
234
236
  end
235
237
 
236
238
  def predefined_datetime_ranges # rubocop:todo Metrics/AbcSize
237
239
  {
238
- 'Today': Time.zone.now.beginning_of_day..Time.zone.now.end_of_day,
239
- 'Yesterday': [Time.zone.now.beginning_of_day - 1.day, Time.zone.now.end_of_day - 1.day],
240
- 'This Month': Time.zone.today.beginning_of_month.beginning_of_day...Time.zone.now.end_of_day,
241
- 'Last Month':
240
+ Today: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day,
241
+ Yesterday: [Time.zone.now.beginning_of_day - 1.day, Time.zone.now.end_of_day - 1.day],
242
+ "This Month": Time.zone.today.beginning_of_month.beginning_of_day...Time.zone.now.end_of_day,
243
+ "Last Month":
242
244
  Time.zone.today.prev_month.beginning_of_month.beginning_of_day...Time.zone.today.prev_month.end_of_month.end_of_day,
243
- 'This Year': Time.zone.today.beginning_of_year.beginning_of_day...Time.zone.today.end_of_day,
245
+ "This Year": Time.zone.today.beginning_of_year.beginning_of_day...Time.zone.today.end_of_day
244
246
  }
245
247
  end
246
248
  end
@@ -7,13 +7,18 @@ module TrkDatatables
7
7
 
8
8
  def self.determine_db_type_for_column
9
9
  # converts TrkDatatables::IntegerCalculatedInDb to :integer
10
- name.sub('TrkDatatables::', '').sub('CalculatedInDb', '').downcase.to_sym
10
+ name.sub("TrkDatatables::", "").sub("CalculatedInDb", "").downcase.to_sym
11
11
  end
12
12
  end
13
+
13
14
  class StringCalculatedInDb < CalculatedInDb; end
15
+
14
16
  class IntegerCalculatedInDb < CalculatedInDb; end
17
+
15
18
  class DateCalculatedInDb < CalculatedInDb; end
19
+
16
20
  class DatetimeCalculatedInDb < CalculatedInDb; end
21
+
17
22
  class BooleanCalculatedInDb < CalculatedInDb; end
18
23
 
19
24
  class ColumnKeyOptions
@@ -55,10 +60,10 @@ module TrkDatatables
55
60
  # for 'columns' that are calculated in Ruby you need to disable search and
56
61
  # order and than it will not be used in queries
57
62
 
58
- STRING_TYPE_CAST_POSTGRES = 'VARCHAR'.freeze
59
- STRING_TYPE_CAST_MYSQL = 'CHAR'.freeze
60
- STRING_TYPE_CAST_SQLITE = 'TEXT'.freeze
61
- STRING_TYPE_CAST_ORACLE = 'VARCHAR2(4000)'.freeze
63
+ STRING_TYPE_CAST_POSTGRES = "VARCHAR".freeze
64
+ STRING_TYPE_CAST_MYSQL = "CHAR".freeze
65
+ STRING_TYPE_CAST_SQLITE = "TEXT".freeze
66
+ STRING_TYPE_CAST_ORACLE = "VARCHAR2(4000)".freeze
62
67
 
63
68
  DB_ADAPTER_STRING_TYPE_CAST = {
64
69
  postgresql: STRING_TYPE_CAST_POSTGRES,
@@ -88,12 +93,12 @@ module TrkDatatables
88
93
  # In case first element is hash than we will use that hash
89
94
  if cols.is_a? Array
90
95
  cols = if cols.first.is_a? Hash
91
- cols.first
92
- else
93
- cols.each_with_object({}) do |column_key, hash|
94
- hash[column_key.to_sym] = {}
95
- end
96
- end
96
+ cols.first
97
+ else
98
+ cols.each_with_object({}) do |column_key, hash|
99
+ hash[column_key.to_sym] = {}
100
+ end
101
+ end
97
102
  end
98
103
  _set_data(cols)
99
104
  _set_global_search_cols(global_search_cols)
@@ -102,26 +107,28 @@ module TrkDatatables
102
107
 
103
108
  def _set_data(cols)
104
109
  @data = cols.each_with_object([]) do |(column_key, column_options), arr|
105
- raise Error, 'Column options needs to be a Hash' unless column_options.is_a? Hash
110
+ raise Error, "Column options needs to be a Hash" unless column_options.is_a? Hash
106
111
 
107
112
  column_options.assert_valid_keys(*COLUMN_OPTIONS)
108
- table_name, column_name = column_key.to_s.split '.'
109
- if table_name.present? && table_name.ends_with?('_calculated_in_db')
113
+ table_name, column_name = column_key.to_s.split "."
114
+ if table_name.present? && table_name.end_with?("_calculated_in_db")
110
115
  # in calculated columns table_name is used only to determine type
111
116
  column_key = column_name
112
117
  elsif table_name.present? && column_name.nil?
113
- raise Error, 'Unless table name ends with _calculated_in_db, column key needs to have one dot for example: posts.name'
118
+ raise Error,
119
+ "Unless table name ends with _calculated_in_db, column key needs to have one dot for example: posts.name"
114
120
  end
115
121
 
116
122
  if table_name.blank?
117
- column_name = column_options[TITLE_OPTION] || 'actions' # some default name for a title
123
+ column_name = column_options[TITLE_OPTION] || "actions" # some default name for a title
118
124
  column_options[SEARCH_OPTION] = false
119
125
  column_options[ORDER_OPTION] = false
120
126
  else
121
127
  table_class = _determine_table_class table_name, column_options[CLASS_NAME]
122
128
 
123
129
  unless column_options[SEARCH_OPTION] == false && column_options[ORDER_OPTION] == false
124
- column_type_in_db = column_options[COLUMN_TYPE_IN_DB] || _determine_db_type_for_column(table_class, column_name)
130
+ column_type_in_db = column_options[COLUMN_TYPE_IN_DB] || _determine_db_type_for_column(table_class,
131
+ column_name)
125
132
  end
126
133
  end
127
134
  arr << {
@@ -132,7 +139,7 @@ module TrkDatatables
132
139
  column_type_in_db: column_type_in_db,
133
140
  # the following are used for RenderHtml
134
141
  title: column_options[TITLE_OPTION] || _determine_column_name(table_class, column_name),
135
- html_options: html_options(column_options, column_type_in_db),
142
+ html_options: html_options(column_options, column_type_in_db)
136
143
  }
137
144
  end
138
145
  end
@@ -145,7 +152,7 @@ module TrkDatatables
145
152
  # note that when class is not eager loaded than const_defined? returns false
146
153
  if class_name.present?
147
154
  class_name.constantize
148
- elsif table_name.ends_with? '_calculated_in_db'
155
+ elsif table_name.end_with? "_calculated_in_db"
149
156
  "TrkDatatables::#{table_name.classify}".constantize
150
157
  else
151
158
  table_name.classify.constantize
@@ -153,10 +160,13 @@ module TrkDatatables
153
160
  end
154
161
 
155
162
  def _set_global_search_cols(global_search_cols)
156
- raise Error, 'global_search_cols should be array, for example %w[users.name]' unless global_search_cols.is_a? Array
163
+ unless global_search_cols.is_a? Array
164
+ raise Error,
165
+ "global_search_cols should be array, for example %w[users.name]"
166
+ end
157
167
 
158
168
  @global_search_cols = global_search_cols.each_with_object([]) do |column_key, arr|
159
- table_name, column_name = column_key.to_s.split '.'
169
+ table_name, column_name = column_key.to_s.split "."
160
170
  table_class = _determine_table_class table_name
161
171
  column_type_in_db = _determine_db_type_for_column(table_class, column_name)
162
172
  arr << {
@@ -164,7 +174,7 @@ module TrkDatatables
164
174
  column_options: {},
165
175
  table_class: table_class,
166
176
  column_name: column_name,
167
- column_type_in_db: column_type_in_db,
177
+ column_type_in_db: column_type_in_db
168
178
  }
169
179
  end
170
180
  end
@@ -173,13 +183,13 @@ module TrkDatatables
173
183
  def _determine_string_type_cast # :nodoc:
174
184
  if defined?(::ActiveRecord::Base)
175
185
  current_adapter = if ::ActiveRecord::Base.respond_to?(:connection_db_config)
176
- ::ActiveRecord::Base.connection_db_config.configuration_hash[:adapter]
177
- else
178
- ::ActiveRecord::Base.connection_config[:adapter]
179
- end
186
+ ::ActiveRecord::Base.connection_db_config.configuration_hash[:adapter]
187
+ else
188
+ ::ActiveRecord::Base.connection_config[:adapter]
189
+ end
180
190
  DB_ADAPTER_STRING_TYPE_CAST[current_adapter.to_sym]
181
191
  else
182
- 'not_used'
192
+ "not_used"
183
193
  end
184
194
  end
185
195
 
@@ -196,7 +206,7 @@ module TrkDatatables
196
206
  elsif defined?(::Neo4j::ActiveNode)
197
207
  (table_class.declared_properties[column_name][:type] || String).name.downcase
198
208
  else
199
- raise NotImplementedError, 'I work only with ActiveRecord and Neo4j'
209
+ raise NotImplementedError, "I work only with ActiveRecord and Neo4j"
200
210
  end
201
211
  end
202
212
 
@@ -235,27 +245,27 @@ module TrkDatatables
235
245
  i = @data.find_index do |column_key_option|
236
246
  column_key_option[:column_key] == column_key.to_sym
237
247
  end
238
- raise Error, "Can't find index for #{column_key} in #{@data.map { |d| d[:column_key] }.join(', ')}" if i.nil?
248
+ raise Error, "Can't find index for #{column_key} in #{@data.map { |d| d[:column_key] }.join(", ")}" if i.nil?
239
249
 
240
250
  i
241
251
  end
242
252
 
243
253
  def html_options(column_options, column_type_in_db)
244
254
  res = {}
245
- res['data-searchable'] = false if column_options[SEARCH_OPTION] == false
246
- res['data-orderable'] = false if column_options[ORDER_OPTION] == false
247
- res['data-datatable-hidden-column'] = true if column_options[HIDE_OPTION] == true
248
- res['data-datatable-checkbox'] = true if column_type_in_db == :boolean
255
+ res["data-searchable"] = false if column_options[SEARCH_OPTION] == false
256
+ res["data-orderable"] = false if column_options[ORDER_OPTION] == false
257
+ res["data-datatable-hidden-column"] = true if column_options[HIDE_OPTION] == true
258
+ res["data-datatable-checkbox"] = true if column_type_in_db == :boolean
249
259
  if %i[date datetime].include? column_type_in_db
250
- res['data-datatable-range'] = column_type_in_db == :datetime ? :datetime : true
260
+ res["data-datatable-range"] = (column_type_in_db == :datetime) ? :datetime : true
251
261
  if column_options[PREDEFINED_RANGES].present? ||
252
262
  (@predefined_ranges.try(:[], column_type_in_db).present? && column_options[PREDEFINED_RANGES] != false)
253
- res['data-datatable-predefined-ranges'] = if column_options[PREDEFINED_RANGES].is_a? Hash
254
- column_options[PREDEFINED_RANGES]
255
- else
256
- @predefined_ranges[column_type_in_db]
257
- end
258
- res['data-datatable-predefined-ranges'].transform_values! do |range|
263
+ res["data-datatable-predefined-ranges"] = if column_options[PREDEFINED_RANGES].is_a? Hash
264
+ column_options[PREDEFINED_RANGES]
265
+ else
266
+ @predefined_ranges[column_type_in_db]
267
+ end
268
+ res["data-datatable-predefined-ranges"].transform_values! do |range|
259
269
  [range.first.to_s, range.last.to_s]
260
270
  end
261
271
  end
@@ -40,12 +40,12 @@ module TrkDatatables
40
40
  @dt_orders = []
41
41
  return @dt_orders if @params[:order].blank?
42
42
 
43
- @dt_orders = \
43
+ @dt_orders =
44
44
  @params[:order].each_with_object([]) do |(_index, dt_order), a|
45
45
  # for order we ignore key (_index) since order is preserved
46
46
  a << [
47
47
  dt_order[:column].to_i,
48
- dt_order[:dir]&.to_s&.casecmp('ASC')&.zero? ? :asc : :desc,
48
+ dt_order[:dir]&.to_s&.casecmp("ASC")&.zero? ? :asc : :desc
49
49
  ]
50
50
  end
51
51
  @dt_orders
@@ -69,9 +69,9 @@ module TrkDatatables
69
69
  @params[:columns].each.map do |(dt_position, dt_column)|
70
70
  @dt_columns[dt_position.to_i] = {
71
71
  index: dt_position.to_i,
72
- searchable: dt_column[:searchable].to_s != 'false', # if nil as it is in set_params, than use true
73
- orderable: dt_column[:orderable].to_s != 'false', # if nil as it is in set_params, than use true
74
- search_value: (dt_column[:search] && dt_column[:search][:value]) || '',
72
+ searchable: dt_column[:searchable].to_s != "false", # if nil as it is in set_params, than use true
73
+ orderable: dt_column[:orderable].to_s != "false", # if nil as it is in set_params, than use true
74
+ search_value: (dt_column[:search] && dt_column[:search][:value]) || ""
75
75
  }
76
76
  end
77
77
  @dt_columns.each_with_index do |dt_column, i|
@@ -81,20 +81,20 @@ module TrkDatatables
81
81
  index: i,
82
82
  searchable: true,
83
83
  orderable: true,
84
- search_value: '',
84
+ search_value: ""
85
85
  }
86
86
  end
87
87
  end
88
88
 
89
89
  def search_all
90
- @params.dig(:search, :value) || ''
90
+ @params.dig(:search, :value) || ""
91
91
  rescue TypeError => e
92
92
  raise Error, e.message + '. Global search is in a format: { "search": { "value": "ABC" } }'
93
93
  end
94
94
 
95
95
  def as_json(all_count, filtered_count, data, additional = {})
96
96
  additional = {} if additional.nil?
97
- raise Error, 'additional_data_for_json needs to be a hash' unless additional.is_a? Hash
97
+ raise Error, "additional_data_for_json needs to be a hash" unless additional.is_a? Hash
98
98
 
99
99
  draw = @params[:draw].to_i
100
100
  {
@@ -102,7 +102,7 @@ module TrkDatatables
102
102
  recordsTotal: all_count,
103
103
  recordsFiltered: filtered_count,
104
104
  **additional,
105
- data: data,
105
+ data: data
106
106
  }
107
107
  end
108
108
 
@@ -111,7 +111,7 @@ module TrkDatatables
111
111
  end
112
112
 
113
113
  def self.order_set(column_index, direction)
114
- {order: {'0': {column: column_index, dir: direction}}}
114
+ {order: {"0": {column: column_index, dir: direction}}}
115
115
  end
116
116
 
117
117
  def self.form_field_name(column_index)
@@ -121,51 +121,52 @@ module TrkDatatables
121
121
  def param_get(column_index)
122
122
  @params.dig :columns, column_index.to_s, :search, :value
123
123
  rescue TypeError => e
124
- raise Error, "#{e.message}. Column search is in a format: { \"columns\": { \"0\": { \"search\": { \"value\": { \"ABC\" } } } } }"
124
+ raise Error,
125
+ "#{e.message}. Column search is in a format: { \"columns\": { \"0\": { \"search\": { \"value\": { \"ABC\" } } } } }"
125
126
  end
126
127
 
127
128
  def self.sample_view_params(options = {})
128
129
  OpenStruct.new(
129
- params: sample_params(options),
130
+ params: sample_params(options)
130
131
  )
131
132
  end
132
133
 
133
134
  def self.sample_params(options = {})
134
135
  HashWithIndifferentAccess.new(
135
- draw: '1',
136
- start: '0',
137
- length: '10',
136
+ draw: "1",
137
+ start: "0",
138
+ length: "10",
138
139
  search: {
139
- value: '', regex: 'false'
140
+ value: "", regex: "false"
140
141
  },
141
142
  order: {
142
- '0': {column: '0', dir: 'desc'}
143
+ "0": {column: "0", dir: "desc"}
143
144
  },
144
145
  # [:columns] should have the same size as column_key_options since we
145
146
  # ignore keys, and use positions
146
147
  columns: {
147
- '0': {
148
- searchable: 'true',
149
- orderable: 'true',
148
+ "0": {
149
+ searchable: "true",
150
+ orderable: "true",
150
151
  search: {
151
- value: '', regex: 'false'
152
+ value: "", regex: "false"
152
153
  }
153
154
  },
154
- '1': {
155
- searchable: 'true',
156
- orderable: 'true',
155
+ "1": {
156
+ searchable: "true",
157
+ orderable: "true",
157
158
  search: {
158
- value: '', regex: 'false'
159
+ value: "", regex: "false"
159
160
  }
160
161
  },
161
- '2': {
162
- searchable: 'true',
163
- orderable: 'false',
162
+ "2": {
163
+ searchable: "true",
164
+ orderable: "false",
164
165
  search: {
165
- value: '', regex: 'false'
166
+ value: "", regex: "false"
166
167
  }
167
- },
168
- },
168
+ }
169
+ }
169
170
  ).merge options
170
171
  end
171
172
  end
@@ -6,7 +6,7 @@ module TrkDatatables
6
6
  # https://neo4jrb.readthedocs.io/en/stable/QueryClauseMethods.html?highlight=where#where
7
7
  sql = @column_key_options.searchable_and_global_search.map do |column_key_option|
8
8
  "#{column_key_option[:column_key]} =~ ?"
9
- end.join(' or ')
9
+ end.join(" or ")
10
10
 
11
11
  filtered.where sql, ".*#{@dt_params.search_all}.*"
12
12
  end
@@ -17,8 +17,7 @@ module TrkDatatables
17
17
 
18
18
  def order_and_paginate_items(filtered)
19
19
  filtered = order_items filtered
20
- filtered = filtered.offset(@dt_params.dt_offset).limit(dt_per_page_or_default)
21
- filtered
20
+ filtered.offset(@dt_params.dt_offset).limit(dt_per_page_or_default)
22
21
  end
23
22
 
24
23
  def order_items(filtered)
@@ -28,7 +27,7 @@ module TrkDatatables
28
27
 
29
28
  queries << "#{column_key_option[:column_key]} #{direction}"
30
29
  end
31
- filtered.order(order_by.join(', '))
30
+ filtered.order(order_by.join(", "))
32
31
  end
33
32
  end
34
33
  end
@@ -1,6 +1,6 @@
1
1
  module TrkDatatables
2
2
  class Preferences
3
- KEY_IN_PREFERENCES = :trk_datatables
3
+ KEY_IN_PREFERENCES = "trk_datatables"
4
4
  def initialize(holder, field, class_name)
5
5
  @holder = holder
6
6
  @field = field
@@ -15,14 +15,14 @@ module TrkDatatables
15
15
 
16
16
  result = @holder.send(@field).dig KEY_IN_PREFERENCES, @class_name, key
17
17
  return result if check_value.nil?
18
- return result if check_value.call result
18
+ result if check_value.call result
19
19
  end
20
20
 
21
21
  def set(key, value)
22
22
  return unless @holder
23
23
 
24
24
  h = {KEY_IN_PREFERENCES => {@class_name => {key => value}}}
25
- @holder.send("#{@field}=", {}) if @holder.send(@field).nil?
25
+ @holder.send(:"#{@field}=", {}) if @holder.send(@field).nil?
26
26
  @holder.send(@field).deep_merge! h
27
27
  @holder.save!
28
28
  end
@@ -43,16 +43,16 @@ module TrkDatatables
43
43
  inline = true
44
44
  end
45
45
  self.class.indent += 1
46
- html = "#{' ' * self.class.indent}<#{tag}".html_safe
46
+ html = "#{" " * self.class.indent}<#{tag}".html_safe
47
47
  options.each do |attribute, value|
48
48
  value = value.to_json if value.is_a?(Hash) || value.is_a?(Array)
49
49
  html << " #{attribute}='".html_safe << replace_quote(value) << "'".html_safe
50
50
  end
51
51
  html << if inline
52
- '>'.html_safe << content.to_s << "</#{tag}>\n".html_safe
53
- else
54
- ">\n".html_safe << yield << "\n#{' ' * self.class.indent}</#{tag}>".html_safe
55
- end
52
+ ">".html_safe << content.to_s << "</#{tag}>\n".html_safe
53
+ else
54
+ ">\n".html_safe << yield << "\n#{" " * self.class.indent}</#{tag}>".html_safe
55
+ end
56
56
  self.class.indent -= 1 if self.class.indent > 1
57
57
  html
58
58
  end
@@ -62,7 +62,7 @@ module TrkDatatables
62
62
  def _select_find_options(options, search_value)
63
63
  selected = search_value.to_s.split(MULTIPLE_OPTION_SEPARATOR)
64
64
  options.map do |key, value|
65
- {key: key, value: value}.merge(selected.include?(value.to_s) ? {selected: 'selected'} : {})
65
+ {key: key, value: value}.merge(selected.include?(value.to_s) ? {selected: "selected"} : {})
66
66
  end
67
67
  end
68
68
 
@@ -82,14 +82,14 @@ module TrkDatatables
82
82
  _content_tag(
83
83
  :table,
84
84
  class: "table table-bordered table-striped #{@html_options[:class]}",
85
- 'data-datatable': true,
86
- 'data-datatable-ajax-url': @search_link,
87
- 'data-datatable-page-length': @datatable.dt_per_page_or_default,
88
- 'data-datatable-order': @datatable.dt_orders_or_default_index_and_direction.to_json,
85
+ "data-datatable": true,
86
+ "data-datatable-ajax-url": @search_link,
87
+ "data-datatable-page-length": @datatable.dt_per_page_or_default,
88
+ "data-datatable-order": @datatable.dt_orders_or_default_index_and_direction.to_json,
89
89
  # for initial page load we do not have ability to show recordsTotal
90
90
  # https://github.com/trkin/trk_datatables_js/issues/1
91
- 'data-datatable-total-length': @datatable.filtered_items_count,
92
- 'data-datatable-dom': @html_options[:'data-datatable-dom'] || '<"trk-global-search-wrapper"f>rtp<"trk-move-up"il>',
91
+ "data-datatable-total-length": @datatable.filtered_items_count,
92
+ "data-datatable-dom": @html_options[:"data-datatable-dom"] || '<"trk-global-search-wrapper"f>rtp<"trk-move-up"il>'
93
93
  ) do
94
94
  thead << "\n".html_safe << tbody
95
95
  end +
@@ -102,11 +102,14 @@ module TrkDatatables
102
102
  safe_join(@datatable.column_key_options.map do |column_key_option|
103
103
  options = column_key_option[:html_options]
104
104
  # add eventual value from params
105
- search_value = @datatable.param_get(column_key_option[:column_key]) if options['data-searchable'] != false
106
- options['data-datatable-search-value'] = search_value if search_value.present?
105
+ search_value = @datatable.param_get(column_key_option[:column_key]) if options["data-searchable"] != false
106
+ options["data-datatable-search-value"] = search_value if search_value.present?
107
107
  # add eventual select element
108
108
  select_options = column_key_option[:column_options][ColumnKeyOptions::SELECT_OPTIONS]
109
- options['data-datatable-multiselect'] = _select_find_options select_options, search_value if select_options.present?
109
+ if select_options.present?
110
+ options["data-datatable-multiselect"] =
111
+ _select_find_options select_options, search_value
112
+ end
110
113
  # all other options are pulled from column_key_option[:html_options]
111
114
  _content_tag :th, options, column_key_option[:title]
112
115
  end)
@@ -148,7 +151,7 @@ module TrkDatatables
148
151
  # # https://github.com/trkin/trk_datatables_js/issues/1
149
152
  # 'data-datatable-total-length': @datatable.filtered_items_count,
150
153
  # ) do
151
- ''
154
+ ""
152
155
  end
153
156
  end
154
157
  end
@@ -1,3 +1,3 @@
1
1
  module TrkDatatables
2
- VERSION = '0.2.15'.freeze
2
+ VERSION = "0.2.16".freeze
3
3
  end
@@ -1,22 +1,23 @@
1
- require 'trk_datatables/version'
2
- # modules
3
- require 'trk_datatables/preferences.rb'
4
- require 'trk_datatables/base_helpers'
5
- require 'trk_datatables/base'
6
- require 'trk_datatables/active_record'
7
- require 'trk_datatables/neo4j'
8
- require 'trk_datatables/dt_params'
9
- require 'trk_datatables/column_key_options.rb'
10
- require 'trk_datatables/render_html.rb'
11
-
1
+ require "trk_datatables/version"
12
2
  # libs
13
- require 'active_support/core_ext/hash/indifferent_access'
14
- require 'active_support/core_ext/hash/keys'
15
- require 'active_support/core_ext/string/inflections'
16
- require 'active_support/core_ext/string/output_safety'
17
- require 'active_support/core_ext/time/zones'
3
+ require "active_support/core_ext/hash/indifferent_access"
4
+ require "active_support/core_ext/hash/keys"
5
+ require "active_support/core_ext/string/inflections"
6
+ require "active_support/core_ext/string/output_safety"
7
+ require "active_support/core_ext/time/zones"
18
8
 
9
+ require "ostruct"
19
10
  # we need to define here since some conventions will look for definition in this file
11
+ # modules
12
+ require "trk_datatables/preferences"
13
+ require "trk_datatables/base_helpers"
14
+ require "trk_datatables/base"
15
+ require "trk_datatables/active_record"
16
+ require "trk_datatables/neo4j"
17
+ require "trk_datatables/dt_params"
18
+ require "trk_datatables/column_key_options"
19
+ require "trk_datatables/render_html"
20
+
20
21
  module TrkDatatables
21
22
  class Error < StandardError
22
23
  def message
@@ -1,31 +1,30 @@
1
- lib = File.expand_path('lib', __dir__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'trk_datatables/version'
3
+ require "trk_datatables/version"
4
4
 
5
- # rubocop:disable Metrics/BlockLength
6
5
  Gem::Specification.new do |spec|
7
- spec.name = 'trk_datatables'
8
- spec.version = TrkDatatables::VERSION
9
- spec.authors = ['Dusan Orlovic']
10
- spec.email = ['[email protected]']
6
+ spec.name = "trk_datatables"
7
+ spec.version = TrkDatatables::VERSION
8
+ spec.authors = ["Dusan Orlovic"]
9
+ spec.email = ["[email protected]"]
11
10
 
12
- spec.summary = 'Gem that simplify using datatables with Ruby on Rails and Sinatra.'
13
- spec.description = 'Html render first page, sort and filter...'
14
- spec.homepage = 'https://github.com/trkin/trk_datatables'
15
- spec.license = 'MIT'
11
+ spec.summary = "Gem that simplify using datatables with Ruby on Rails and Sinatra."
12
+ spec.description = "Html render first page, sort and filter..."
13
+ spec.homepage = "https://github.com/trkin/trk_datatables"
14
+ spec.license = "MIT"
16
15
 
17
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
18
  if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
20
 
22
- spec.metadata['homepage_uri'] = spec.homepage
23
- spec.metadata['source_code_uri'] = 'https://github.com/trkin/trk_datatables'
24
- spec.metadata['changelog_uri'] = 'https://github.com/trkin/trk_datatables/blob/master/CHANGELOG.md'
25
- spec.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = "https://github.com/trkin/trk_datatables"
23
+ spec.metadata["changelog_uri"] = "https://github.com/trkin/trk_datatables/blob/master/CHANGELOG.md"
24
+ spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
26
25
  else
27
- raise 'RubyGems 2.0 or newer is required to protect against ' \
28
- 'public gem pushes.'
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
29
28
  end
30
29
 
31
30
  # Specify which files should be added to the gem when it is released.
@@ -33,22 +32,22 @@ Gem::Specification.new do |spec|
33
32
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
34
33
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
34
  end
36
- spec.bindir = 'exe'
37
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
- spec.require_paths = ['lib']
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
39
38
 
40
39
  # for HashWithIndifferentAccess
41
- spec.add_dependency 'activesupport'
40
+ spec.add_dependency "activesupport"
42
41
 
43
- spec.add_development_dependency 'activerecord', '~> 6.0'
44
- spec.add_development_dependency 'bundler', '~> 2.0'
45
- spec.add_development_dependency 'byebug'
46
- spec.add_development_dependency 'database_cleaner'
47
- spec.add_development_dependency 'minitest', '~> 5.0'
48
- spec.add_development_dependency 'minitest-color'
49
- spec.add_development_dependency 'timecop'
50
- spec.add_development_dependency 'pg'
51
- spec.add_development_dependency 'rake', '~> 10.0'
52
- spec.add_development_dependency 'sqlite3'
42
+ spec.add_development_dependency "activerecord", "~> 6.0"
43
+ spec.add_development_dependency "bundler", "~> 2.0"
44
+ spec.add_development_dependency "byebug"
45
+ spec.add_development_dependency "database_cleaner"
46
+ spec.add_development_dependency "minitest", "~> 5.0"
47
+ spec.add_development_dependency "minitest-color"
48
+ spec.add_development_dependency "pg"
49
+ spec.add_development_dependency "rake", "~> 10.0"
50
+ spec.add_development_dependency "sqlite3"
51
+ spec.add_development_dependency "timecop"
52
+ spec.add_development_dependency "standard"
53
53
  end
54
- # rubocop:enable Metrics/BlockLength
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trk_datatables
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dusan Orlovic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: timecop
112
+ name: pg
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,21 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: pg
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '10.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '10.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: sqlite3
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - ">="
@@ -137,21 +151,21 @@ dependencies:
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: rake
154
+ name: timecop
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
- version: '10.0'
159
+ version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - "~>"
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
- version: '10.0'
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
- name: sqlite3
168
+ name: standard
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - ">="
@@ -172,6 +186,7 @@ extensions: []
172
186
  extra_rdoc_files: []
173
187
  files:
174
188
  - ".gitignore"
189
+ - ".ruby-version"
175
190
  - ".travis.yml"
176
191
  - CHANGELOG.md
177
192
  - CODE_OF_CONDUCT.md