active_record_extended 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c136dceff4eb13a4c368aef03c70ae74bf3c856d3dadaa38e468e3f3369455d
4
- data.tar.gz: 1d7f194a4760a812e2a6aa22f20e1a62914e68d1fcb52cb223d724104597cc31
3
+ metadata.gz: 29516f7d7b4854e6a04653d6e146e5945efa9ade39ad99d171e17bd2f11e1fe3
4
+ data.tar.gz: f898fa543fe7d79f9fa98e015e86044cccf7ae4c940abe13c912fbb9d435a010
5
5
  SHA512:
6
- metadata.gz: a0d6e454d6c2dc91d28472cc1911043bc62a94e554d85bc77b0cdbbdedcc4158f7f6f43164a7cd5b27d8609ececf4b532f9a4ebe26c725267c77de4b1c201d38
7
- data.tar.gz: 28980520ea5779c79a9fd131157a5b2cdecba1d1fa8464dbba34ef299501094e97db64db303c5d0ad51cf3cb2a52b130562a71d64f866e67f6446ce79082de74
6
+ metadata.gz: b10866d1c5e95ddb6e37df09085b1e86183bfa9b4b217b71f5f3ce8973926fc6f83591c352515098d5800276afaf1ff538ac50bea8cd5f355da7d67768570970
7
+ data.tar.gz: 654a00730852609edf1ef1e47893896647d06548bc563aa4546713b7398981fbe050d7951dee47eb2b97c673e370ff40b0949aa763c6665662deb3c08625bc53
@@ -51,7 +51,7 @@ module ActiveRecordExtended
51
51
  private
52
52
 
53
53
  def build_json_literal(arel_klass, values:, col_alias: DEFAULT_ALIAS)
54
- json_values = flatten_to_sql(values.to_a, &method(:literal_key))
54
+ json_values = flatten_to_sql(values.to_a) { |value| literal_key(value) }
55
55
  col_alias = double_quote(col_alias)
56
56
  json_build_obj = arel_klass.new(json_values)
57
57
  @scope.select(nested_alias_escape(json_build_obj, col_alias))
@@ -117,7 +117,7 @@ module ActiveRecordExtended
117
117
  lean_opts.call(:value) { arg.delete(:value).presence }
118
118
  lean_opts.call(:col_alias) { arg.delete(:as) }
119
119
  lean_opts.call(:order_by) { order_by_expression(arg.delete(:order_by)) }
120
- lean_opts.call(:from) { arg.delete(:from).tap(&method(:pipe_cte_with!)) }
120
+ lean_opts.call(:from) { arg.delete(:from).tap { |from_clause| pipe_cte_with!(from_clause) } }
121
121
  lean_opts.call(:cast_with) { casting_options(arg.delete(:cast_with) || arg.delete(:cast_as_array)) }
122
122
  end
123
123
 
@@ -65,7 +65,7 @@ module ActiveRecordExtended
65
65
  def hash_to_dot_notation(column)
66
66
  case column
67
67
  when Hash, Array
68
- column.to_a.flat_map(&method(:hash_to_dot_notation)).join(".")
68
+ column.to_a.flat_map { |col| hash_to_dot_notation(col) }.join(".")
69
69
  when String, Symbol
70
70
  /^([[:alpha:]]+)$/.match?(column.to_s) ? double_quote(column) : column
71
71
  else
@@ -92,7 +92,7 @@ module ActiveRecordExtended
92
92
  when "array", "true"
93
93
  wrap_with_array(query, alias_name)
94
94
  when AGGREGATE_ONE_LINERS
95
- expr = to_sql_array(query, &method(:group_when_needed))
95
+ expr = to_sql_array(query) { |value| group_when_needed(value) }
96
96
  casted_query = ::Arel::Nodes::AggregateFunctionName.new(cast_with, expr, distinct).order_by(order_expr)
97
97
  nested_alias_escape(casted_query, alias_name)
98
98
  else
@@ -59,7 +59,7 @@ module ActiveRecordExtended
59
59
  protected
60
60
 
61
61
  def append_union_order!(union_type, args)
62
- args.each(&method(:pipe_cte_with!))
62
+ args.each { |arg| pipe_cte_with!(arg) }
63
63
  flatten_scopes = flatten_to_sql(args)
64
64
  @scope.union_values += flatten_scopes
65
65
  calculate_union_operation!(union_type, flatten_scopes.size)
@@ -24,8 +24,8 @@ module ActiveRecordExtended
24
24
  return false unless order_by && order_by.presence.present?
25
25
 
26
26
  to_ordered_table_path(order_by)
27
- .tap(&method(:process_ordering_arguments!))
28
- .tap(&method(:scope_preprocess_order_args))
27
+ .tap { |order_args| process_ordering_arguments!(order_args) }
28
+ .tap { |order_args| scope_preprocess_order_args(order_args) }
29
29
  end
30
30
 
31
31
  #
@@ -172,7 +172,7 @@ module ActiveRecordExtended
172
172
  end
173
173
 
174
174
  def generate_named_function(function_name, *args)
175
- args.map!(&method(:to_arel_sql))
175
+ args.map! { |arg| to_arel_sql(arg) }
176
176
  function_name = function_name.to_s.upcase
177
177
  ::Arel::Nodes::NamedFunction.new(to_arel_sql(function_name), args)
178
178
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordExtended
4
- VERSION = "1.3.1"
4
+ VERSION = "1.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_extended
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Protacio-Karaszi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-10-02 00:00:00.000000000 Z
13
+ date: 2019-11-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord