eac_rails_utils 0.23.1 → 0.23.3

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: d9f7ed3ae0a13dc0aa2f380322270a36a0c35784c6bb9b13a5145dcade4ce9ab
4
- data.tar.gz: e87c326dca2c7c0e1de5f8cdabcf35d3daab5bd907d6812b1144cd5c24a4c901
3
+ metadata.gz: bf8f49e079ac5907ff3b0bf020231e2b35e5e8b0a2167b0c7dd6267366973e20
4
+ data.tar.gz: ab0167ce99e19ed9625e43de6587c3bd3949f5ff8b6a35bdeb3513e56b5eaba4
5
5
  SHA512:
6
- metadata.gz: cd14c49a2cd8e303b5542d5d50913ff455c9dd8e8f463ecfad41544c35ebaae034cee96c7d1a14de81f6532613eee511c058425dc6b83fb2d3af94cbf7b21f16
7
- data.tar.gz: 55f27beab83da5a622866bb40f911ee7374e088609040cb7df50ed32262b5e5d76ceba41b95ee97210c6a405c09105e3bb7608447478bdc5e2d096dcfcdf92b4
6
+ metadata.gz: 58061deb5e323692139ef7930a26e9625c89f384b41e8bbc8a903637a5533b24d93bd177865b905fb9478162ac6838ae2a7c37f47cd3fa15ed5518ea5bd57e0e
7
+ data.tar.gz: 4cc872c05aca276bfb9f4a3337a43f7c6c953b40b5282fc48fd78f47cccc6b03d80c5409fcf8b3a06080f6cc3fad939136ea0f29bda50144729b50ae764ce2f0
@@ -45,7 +45,7 @@ module EacRailsUtils
45
45
  private
46
46
 
47
47
  def node_value(node, subpath)
48
- return node if subpath.empty?
48
+ node if subpath.empty?
49
49
  end
50
50
  end
51
51
  end
@@ -22,7 +22,7 @@ module EacRailsUtils
22
22
 
23
23
  # @return [Hash]
24
24
  def tag_attributes
25
- column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h
25
+ column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h # rubocop:disable Style/HashTransformValues, Style/MapToHash
26
26
  end
27
27
  end
28
28
  end
@@ -12,7 +12,7 @@ module EacRailsUtils
12
12
 
13
13
  id = SecureRandom.hex(5)
14
14
  GuiBuilder.new(self).build(entries, id: id, class: 'jMenu') <<
15
- javascript_tag("$(document).ready(function(){$('\##{id}').jMenu();});")
15
+ javascript_tag("$(document).ready(function(){$('##{id}').jMenu();});")
16
16
  end
17
17
 
18
18
  def bootstrap_dropdown_menu(entries, options = {})
@@ -39,7 +39,7 @@ module EacRailsUtils
39
39
  def children_tags
40
40
  view.capture do
41
41
  view.concat tag
42
- @children.values.each do |child| # rubocop:disable Rails/HelperInstanceVariable
42
+ @children.values.each do |child| # rubocop:disable Rails/HelperInstanceVariable, Style/HashEachMethods
43
43
  view.concat(child.children_tags)
44
44
  view.concat("\n")
45
45
  end
@@ -59,7 +59,7 @@ module EacRailsUtils
59
59
  attr_reader :parent, :suffix
60
60
 
61
61
  def initialize(view, parent, suffix)
62
- super view
62
+ super(view)
63
63
  @parent = parent # rubocop:disable Rails/HelperInstanceVariable
64
64
  @suffix = suffix # rubocop:disable Rails/HelperInstanceVariable
65
65
  end
@@ -3,9 +3,9 @@
3
3
  def patch_json?
4
4
  require 'json'
5
5
 
6
- ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.7') &&
7
- ::Gem::Version.new(JSON::VERSION) < ::Gem::Version.new('2')
8
- rescue ::LoadError
6
+ Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7') &&
7
+ Gem::Version.new(JSON::VERSION) < Gem::Version.new('2')
8
+ rescue LoadError
9
9
  false
10
10
  end
11
11
 
@@ -1,23 +1,23 @@
1
- module ActiveRecord::Associations::Builder
1
+ module ActiveRecord::Associations::Builder # rubocop:disable Style/ClassAndModuleChildren, Style/FrozenStringLiteralComment
2
2
  class HasManyForActiveModel < HasMany
3
- if ActiveRecord.version >= Gem::Version.new("5.0.0.beta")
4
- AR_CALLBACK_METHODS = %i(define_callback before_validation after_validation before_save
5
- after_save before_update after_update)
3
+ if ActiveRecord.version >= Gem::Version.new('5.0.0.beta')
4
+ AR_CALLBACK_METHODS = %i[define_callback before_validation after_validation before_save
5
+ after_save before_update after_update].freeze
6
6
 
7
7
  def self.valid_options(_options)
8
- super + [:active_model,
9
- :target_ids] - [:through, :dependent, :source, :source_type, :counter_cache, :as]
8
+ super + %i[active_model
9
+ target_ids] - %i[through dependent source source_type counter_cache as]
10
10
  end
11
11
 
12
12
  def self.define_callbacks(model, reflection)
13
- if AR_CALLBACK_METHODS.all? { |meth| self.respond_to?(meth) }
14
- super
15
- end
13
+ return unless AR_CALLBACK_METHODS.all? { |meth| respond_to?(meth) }
14
+
15
+ super
16
16
  end
17
17
  else
18
18
  def valid_options
19
- super + [:active_model,
20
- :target_ids] - [:through, :dependent, :source, :source_type, :counter_cache, :as]
19
+ super + %i[active_model
20
+ target_ids] - %i[through dependent source source_type counter_cache as]
21
21
  end
22
22
  end
23
23
  end
@@ -1,4 +1,4 @@
1
- module ActiveRecord::Associations
1
+ module ActiveRecord::Associations # rubocop:disable Style/ClassAndModuleChildren, Style/FrozenStringLiteralComment
2
2
  class HasManyForActiveModelAssociation < HasManyAssociation
3
3
  # remove conditions: owner.new_record?, foreign_key_present?
4
4
  def find_target?
@@ -1,15 +1,13 @@
1
- require "active_model"
2
- require "active_record"
3
- require "active_support"
4
- require "eac_rails_utils/models/tableless_associations"
5
- require "eac_rails_utils/models/tableless_associations/hooks"
1
+ require 'active_model' # rubocop:disable Style/FrozenStringLiteralComment
2
+ require 'active_record'
3
+ require 'active_support'
4
+ require 'eac_rails_utils/models/tableless_associations'
5
+ require 'eac_rails_utils/models/tableless_associations/hooks'
6
6
 
7
7
  # Load Railtie
8
8
  begin
9
- require "rails"
9
+ require 'rails'
10
10
  rescue LoadError # rubocop:disable Lint/SuppressedException
11
11
  end
12
12
 
13
- if defined?(Rails)
14
- require "eac_rails_utils/models/tableless_associations/railtie"
15
- end
13
+ require 'eac_rails_utils/models/tableless_associations/railtie' if defined?(Rails)
@@ -18,7 +18,7 @@ module EacRailsUtils
18
18
 
19
19
  module ClassMethods
20
20
  def append_autoload_paths
21
- config.autoload_paths += Dir["#{config.root}/lib/**/"]
21
+ config.autoload_paths += Dir["#{config.root}/lib"]
22
22
  end
23
23
 
24
24
  def append_self_migrations
@@ -10,7 +10,7 @@ module EacRailsUtils
10
10
  # Um array de colunas pode ser passado em options[:skip] de colunas em record que não
11
11
  # terão suas falhas adicionadas.
12
12
  def fetch_record_errors(record, options = {})
13
- record.errors.keys.each do |column| # rubocop:disable Rails/DeprecatedActiveModelErrorsMethods
13
+ record.errors.keys.each do |column| # rubocop:disable Rails/DeprecatedActiveModelErrorsMethods, Style/HashEachMethods
14
14
  fetch_column_errors(record, column, column, options)
15
15
  end
16
16
  end
@@ -83,7 +83,7 @@ module EacRailsUtils
83
83
  b = ''
84
84
  errors.messages.each do |field, messages|
85
85
  b += ' / ' if b != ''
86
- b += field.to_s + ': ' + messages.to_s
86
+ b += field.to_s + ': ' + messages.to_s # rubocop:disable Style/StringConcatenation
87
87
  end
88
88
  b
89
89
  end
@@ -32,7 +32,7 @@ module EacRailsUtils
32
32
  m = /\A(.+)\(([0-9]+)(.)\)\z/.match(key)
33
33
  return unless m
34
34
 
35
- ::OpenStruct.new(key: m[1], index: m[2].to_i - 1, converter: array_value_converter(m[3]))
35
+ ::OpenStruct.new(key: m[1], index: m[2].to_i - 1, converter: array_value_converter(m[3])) # rubocop:disable Style/OpenStructUse
36
36
  end
37
37
 
38
38
  def array_value_set(array_attr, value)
@@ -50,7 +50,9 @@ module EacRailsUtils
50
50
  # Build a list of candidates to search for
51
51
  def compute_type_candidates(type_name)
52
52
  candidates = []
53
- name.scan(/::|$/) { candidates.unshift "#{$`}::#{type_name}" }
53
+ name.scan(/::|$/) do
54
+ candidates.unshift "#{::Regexp.last_match.pre_match}::#{type_name}"
55
+ end
54
56
  candidates << type_name
55
57
  end
56
58
 
@@ -43,7 +43,7 @@ module EacRailsUtils
43
43
  ActiveRecord::Reflection.add_reflection self, name, reflection
44
44
 
45
45
  mixin = generated_association_methods
46
- mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
46
+ mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1 # rubocop:disable Style/DocumentDynamicEvalDefinition
47
47
  def #{options[:target_ids]}=(other_ids)
48
48
  @#{options[:target_ids]} = other_ids
49
49
  association(:#{name}).reset
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsUtils
4
- VERSION = '0.23.1'
4
+ VERSION = '0.23.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
4
+ version: 0.23.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - E.A.C.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-10 00:00:00.000000000 Z
11
+ date: 2024-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass
@@ -99,6 +99,9 @@ dependencies:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0.10'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 0.10.1
102
105
  type: :development
103
106
  prerelease: false
104
107
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,6 +109,9 @@ dependencies:
106
109
  - - "~>"
107
110
  - !ruby/object:Gem::Version
108
111
  version: '0.10'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 0.10.1
109
115
  description:
110
116
  email:
111
117
  executables: []