apple_core 1.5.0 → 1.6.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: ec8382b41b1db19d702cdec4cf4cb8f9ce2ede593353d38badee3ac398b0964c
4
- data.tar.gz: c5112a2ae300974165e0c26628cd6b110063af45ac7f402c6e54c3933cfba5ac
3
+ metadata.gz: 2556df7cbebb3daec1f26d9806d449960174af33b4b46a5b8928c6e8088a158e
4
+ data.tar.gz: 36d23f73e93c2838fbb00a75abee6281e07df81998aa3a091e41bc5876b3e5aa
5
5
  SHA512:
6
- metadata.gz: 2504c1d0f191c10dc8f4e2ca44b8f79c48afcaaf6051f76e3e94319dbdd1777cd4e9eac95fbb00a4150406cbf9df01d6d2bc723147b9bef95acbf5ed1d84f09b
7
- data.tar.gz: 8916366a83a20f470fdd5ab6f28b5c02bb228f6bb2db024b38bc3ac6251785b6ff61d9784f184f315d38eb0c7f1f83148ab6beef3e612fe88cd3b9e5d986ece6
6
+ metadata.gz: 2667b4f75eccdef83b0157ff7cfd20b8af40a5ae86dba6b922904780ae3439698085e125c90b8adab3a417235e1b05b3cf1b5a899dbd88ea55253901dd5a1100
7
+ data.tar.gz: d4717068717a43f8510d154f7f1ef2ca1d9873e236297eb79f3c812d26b3ae8dde40d0f0b3e877333dc865dc1e697c20b0dc08b764f262d899aeeab2531f2c8a
checksums.yaml.gz.sig CHANGED
Binary file
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2016 The Kompanee, Ltd
1
+ Copyright (c) 2010-2019 The Kompanee, Ltd
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -7,38 +7,40 @@ module ActionController
7
7
  module ResourceNaming
8
8
  using ::AppleCore::Refinements::String
9
9
 
10
+ # rubocop:disable Lint/MixedRegexpCaptureTypes
10
11
  CONTROLLER_RESOURCE_NAME_PATTERN = /
11
12
  \A # Beginning of String
12
13
  (?:
13
14
  (?<modules> # Full Modules
14
15
  (?: # Match Root Module (Optional)
15
16
  (?<root_module>
16
- [^\:]+ # The Module Name
17
- (?=\:\:) # Which Must Be Followed By '::'
17
+ [^:]+ # The Module Name
18
+ (?=::) # Which Must Be Followed By '::'
18
19
  )
19
- (?:\:\:)? # Up Through the '::' But Don't
20
+ (?:::)? # Up Through the '::' But Don't
20
21
  # Capture If It's The Sole Module
21
22
  )?
22
23
  (?<submodules> # Match Submodule List (Optional)
23
24
  ( # There May Be Zero or More of These
24
- [^\:]+ # The Module Name
25
- \:\: # Up Through the '::'
25
+ [^:]+ # The Module Name
26
+ :: # Up Through the '::'
26
27
  )*?
27
28
  (?<last_submodule> # The Final Submodule (Optional)
28
- [^\:]+ # The Module Name
29
- (?=\:\:) # Which Must Be Followed By '::'
29
+ [^:]+ # The Module Name
30
+ (?=::) # Which Must Be Followed By '::'
30
31
  )?
31
32
  )?
32
33
  )
33
- \:\: # Required Final Separator
34
+ :: # Required Final Separator
34
35
  )?
35
36
  (?<controller_name>
36
- (?<resource_name>\w+?) # Base Resource Name
37
+ (?<base_resource_name>\w+?) # Base Resource Name
37
38
  (?:Index|Indicies)? # Optional Index Suffix
38
39
  )
39
40
  Controller # Literal 'Controller'
40
41
  \z # End of String
41
42
  /x
43
+ # rubocop:enable Lint/MixedRegexpCaptureTypes
42
44
 
43
45
  def self.included(base)
44
46
  base.extend(self)
@@ -62,14 +64,14 @@ module ResourceNaming
62
64
  end
63
65
 
64
66
  def plural_resource_base_class_name
65
- @plural_resource_base_class_name ||= resource_name
67
+ @plural_resource_base_class_name ||= base_resource_name
66
68
  .pluralize
67
69
  end
68
70
 
69
71
  def singular_resource_class_name
70
72
  @singular_resource_class_name ||= [
71
- name_components['root_module'],
72
- resource_name,
73
+ name_components['modules'],
74
+ base_resource_name,
73
75
  ]
74
76
  .compact
75
77
  .join('::')
@@ -84,9 +86,9 @@ module ResourceNaming
84
86
  @name_components ||= name.match(CONTROLLER_RESOURCE_NAME_PATTERN).named_captures
85
87
  end
86
88
 
87
- def resource_name
88
- @resource_name ||= name_components['resource_name']
89
- .singularize
89
+ def base_resource_name
90
+ @base_resource_name ||= name_components['base_resource_name']
91
+ .singularize
90
92
  end
91
93
  end
92
94
  end
@@ -9,7 +9,7 @@ module Helpers
9
9
  module WebClientUrl
10
10
  using ::AppleCore::Refinements::QueryString
11
11
 
12
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
12
+ # rubocop:disable Metrics/AbcSize
13
13
  def web_client_url(**options)
14
14
  route_name = options.delete(:name)
15
15
 
@@ -48,7 +48,7 @@ module WebClientUrl
48
48
 
49
49
  URI::HTTPS.new(*arguments).to_s
50
50
  end
51
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
51
+ # rubocop:enable Metrics/AbcSize
52
52
  end
53
53
  end
54
54
  end
@@ -14,9 +14,9 @@ module Class
14
14
  module ClassMethods
15
15
  def class_attribute(method_name, options = {})
16
16
  instance_reader = options.fetch(:instance_accessor, true) &&
17
- options.fetch(:instance_reader, true)
17
+ options.fetch(:instance_reader, true)
18
18
  instance_writer = options.fetch(:instance_accessor, true) &&
19
- options.fetch(:instance_writer, true)
19
+ options.fetch(:instance_writer, true)
20
20
 
21
21
  remove_possible_singleton_method(method_name)
22
22
  define_singleton_method(method_name) { options[:default] }
@@ -5,7 +5,7 @@ require 'apple_core/action_view/helpers/web_client_url'
5
5
  module AppleCore
6
6
  class Railtie < Rails::Railtie
7
7
  initializer 'web_client_url.helper' do |_app|
8
- ::ActionView::Base.public_send(:include, AppleCore::ActionView::Helpers::WebClientUrl)
8
+ ::ActionView::Base.include AppleCore::ActionView::Helpers::WebClientUrl
9
9
  end
10
10
  end
11
11
  end
@@ -28,6 +28,26 @@ refine ::Hash do
28
28
  Transforms::Enumerable.deep_transform_values(nil, self, &block)
29
29
  end
30
30
 
31
+ unless method_defined?(:deep_merge)
32
+ def deep_merge(other, &block)
33
+ dup.deep_merge!(other, &block)
34
+ end
35
+ end
36
+
37
+ unless method_defined?(:deep_merge!)
38
+ def deep_merge!(other, &block)
39
+ merge!(other) do |key, value_1, value_2|
40
+ if value_1.is_a?(::Hash) && value_2.is_a?(::Hash)
41
+ value_1.deep_merge(value_2, &block)
42
+ elsif block
43
+ yield(key, value_1, value_2)
44
+ else
45
+ value_2
46
+ end
47
+ end
48
+ end
49
+ end
50
+
31
51
  unless method_defined?(:slice)
32
52
  def slice(*keys)
33
53
  keys.each_with_object({}) do |k, hash|
@@ -29,12 +29,11 @@ end
29
29
  refine ::Hash do
30
30
  unless method_defined?(:to_param)
31
31
  def to_param(namespace = nil)
32
- map { |key, value|
33
- unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
32
+ filter_map { |key, value|
33
+ if (!value.is_a?(Hash) && !value.is_a?(Array)) || !value.empty?
34
34
  value.to_query(namespace ? "#{namespace}[#{key}]" : key)
35
35
  end
36
36
  }
37
- .compact
38
37
  .sort!
39
38
  .join('&')
40
39
  end
@@ -12,6 +12,16 @@ refine ::String do
12
12
  only_digits? ? to_i(base) : nil
13
13
  end
14
14
 
15
+ def indent(*args)
16
+ dup.tap { |v| v.indent!(*args) }
17
+ end
18
+
19
+ def indent!(amount, indent_string = nil, indent_empty_lines = false) # rubocop:disable Style/OptionalBooleanParameter
20
+ indent_string = indent_string || self[/^[ \t]/] || ' '
21
+ regex = indent_empty_lines ? /^/ : /^(?!$)/
22
+ gsub!(regex, indent_string * amount)
23
+ end
24
+
15
25
  unless defined?(ActiveSupport::Inflector)
16
26
  # rubocop:disable Style/PerlBackrefs
17
27
  def camelize(first_letter_casing = :upper)
@@ -50,7 +60,6 @@ refine ::String do
50
60
  constant
51
61
  end
52
62
 
53
- # rubocop:disable Metrics/MethodLength
54
63
  def pluralize
55
64
  result = to_s.dup
56
65
 
@@ -90,9 +99,8 @@ refine ::String do
90
99
 
91
100
  result
92
101
  end
93
- # rubocop:enable Metrics/MethodLength
94
102
 
95
- # rubocop:disable Metrics/MethodLength, Layout/AlignHash
103
+ # rubocop:disable Layout/HashAlignment
96
104
  def singularize
97
105
  result = to_s.dup
98
106
 
@@ -144,7 +152,7 @@ refine ::String do
144
152
 
145
153
  result
146
154
  end
147
- # rubocop:enable Metrics/MethodLength, Layout/AlignHash
155
+ # rubocop:enable Layout/HashAlignment
148
156
 
149
157
  def underscore
150
158
  word = gsub('::', '/')
@@ -25,11 +25,12 @@ class Enumerable
25
25
  end
26
26
 
27
27
  def self.deep_transform_values(key, value, &block)
28
- if value.is_a?(::Hash)
28
+ case value
29
+ when ::Hash
29
30
  value.each_with_object({}) do |(k, v), memo|
30
31
  memo[k] = deep_transform_values(k, v, &block)
31
32
  end
32
- elsif value.is_a?(::Array)
33
+ when ::Array
33
34
  yield(
34
35
  key,
35
36
  value.map { |v| deep_transform_values(nil, v, &block) }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppleCore
4
- VERSION = '1.5.0'
4
+ VERSION = '1.6.0'
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thegranddesign
@@ -10,87 +10,77 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIEcjCCAtqgAwIBAgIBATANBgkqhkiG9w0BAQsFADAxMS8wLQYDVQQDDCZydWJ5
14
- Z2Vtcy9EQz1saXZpbmdoaWdob250aGVibG9nL0RDPWNvbTAeFw0xODA4MDMyMTQ1
15
- MjBaFw0xOTA4MDMyMTQ1MjBaMDExLzAtBgNVBAMMJnJ1YnlnZW1zL0RDPWxpdmlu
16
- Z2hpZ2hvbnRoZWJsb2cvREM9Y29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
17
- igKCAYEAvFj8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VjGwv2OFq0S2tUw9EJXHTN9RpfRUmn
25
+ IHwS9M4gcJO7IzV39a1YL6+9hrabF4+JTSYDehq8oxTdcOPLYyvH54aJWVqCrnLO
26
+ KNa/p6hMmwxTWNS5Vz0uxuEGyE9E0tHbtjIs2XX5AgMBAAGjgaQwgaEwCQYDVR0T
27
+ BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFAK3RicwO0f6+puFN6lRVMOKMJuu
28
+ MDMGA1UdEQQsMCqBKGxvY2FsZXVua25vd244MTArcnVieWdlbXNAcHJvdG9ubWFp
29
+ bC5jb20wMwYDVR0SBCwwKoEobG9jYWxldW5rbm93bjgxMCtydWJ5Z2Vtc0Bwcm90
30
+ b25tYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAQwV6pOp5gm8141pyXeQFI/5E
31
+ rZYO3MvdyZM8O3HMD51LDS8mtMURceaKZM6WTambe2RVX4A++0qUiEnn9K4Fexm/
32
+ SEGaC/Gp+Fg9D1SKfkdq9bgdIhOEUwiGqjczgzNC806AtWZ+awI940oydFYZlpo0
33
+ jMQihPPJEqF1U6JBDMZYV5tX/dJYSGRl9L3s1k2tjoN98q+beNaZQDn21Amml4eK
34
+ KEkMeTTJ2E4GVzR9eKEETLq2LygdUWWZ5NdWOYTxJMdg1GZp3b6X8hJrwfOiizqt
35
+ /ANlIEh11/pOnWa6WPUVpGIMpYdquvmJXnF2LX6zxkKK1hbrebt+vAEAGczgw1Ri
36
+ rkLM6y+BHQdkOTj3VG4MjIU8D4h1Z73Exzxds/VbVKMEz+8JrFjGJ/tYa0PZ8U5p
37
+ 3yXL4G6eW3rdBW/OiLF7GgG2o26d02OMzf4+ubUVS5LQDOcd4vgNPLWzJSBt1YIh
38
+ TgBsED7Me5YdMVXxtTWYsF1VMzaL9hReD3UXGcxe
37
39
  -----END CERTIFICATE-----
38
- date: 2019-01-16 00:00:00.000000000 Z
40
+ date: 2022-07-17 00:00:00.000000000 Z
39
41
  dependencies:
40
42
  - !ruby/object:Gem::Dependency
41
43
  name: activemodel
42
44
  requirement: !ruby/object:Gem::Requirement
43
45
  requirements:
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '6.0'
47
- - - ">="
46
+ - - "~>"
48
47
  - !ruby/object:Gem::Version
49
- version: '4.2'
48
+ version: '7.0'
50
49
  type: :development
51
50
  prerelease: false
52
51
  version_requirements: !ruby/object:Gem::Requirement
53
52
  requirements:
54
- - - "<"
55
- - !ruby/object:Gem::Version
56
- version: '6.0'
57
- - - ">="
53
+ - - "~>"
58
54
  - !ruby/object:Gem::Version
59
- version: '4.2'
55
+ version: '7.0'
60
56
  - !ruby/object:Gem::Dependency
61
57
  name: activerecord
62
58
  requirement: !ruby/object:Gem::Requirement
63
59
  requirements:
64
- - - "<"
65
- - !ruby/object:Gem::Version
66
- version: '6.0'
67
- - - ">="
60
+ - - "~>"
68
61
  - !ruby/object:Gem::Version
69
- version: '4.2'
62
+ version: '7.0'
70
63
  type: :development
71
64
  prerelease: false
72
65
  version_requirements: !ruby/object:Gem::Requirement
73
66
  requirements:
74
- - - "<"
75
- - !ruby/object:Gem::Version
76
- version: '6.0'
77
- - - ">="
67
+ - - "~>"
78
68
  - !ruby/object:Gem::Version
79
- version: '4.2'
69
+ version: '7.0'
80
70
  - !ruby/object:Gem::Dependency
81
71
  name: rspec
82
72
  requirement: !ruby/object:Gem::Requirement
83
73
  requirements:
84
74
  - - "~>"
85
75
  - !ruby/object:Gem::Version
86
- version: '3.7'
76
+ version: '3.11'
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
80
  requirements:
91
81
  - - "~>"
92
82
  - !ruby/object:Gem::Version
93
- version: '3.7'
83
+ version: '3.11'
94
84
  - !ruby/object:Gem::Dependency
95
85
  name: rspeckled
96
86
  requirement: !ruby/object:Gem::Requirement
@@ -131,11 +121,18 @@ files:
131
121
  - lib/apple_core/refinements/string.rb
132
122
  - lib/apple_core/transforms/enumerable.rb
133
123
  - lib/apple_core/version.rb
134
- homepage: https://example.com
124
+ homepage: https://github.com/thekompanee/apple_core
135
125
  licenses:
136
126
  - MIT
137
127
  metadata:
138
128
  allowed_push_host: https://rubygems.org
129
+ bug_tracker_uri: https://github.com/thekompanee/apple_core/issues
130
+ changelog_uri: https://github.com/thekompanee/apple_core/blob/master/CHANGELOG.md
131
+ documentation_uri: https://github.com/thekompanee/apple_core/tree/releases/v1.5.0
132
+ homepage_uri: https://github.com/thekompanee/apple_core
133
+ source_code_uri: https://github.com/thekompanee/apple_core
134
+ wiki_uri: https://github.com/thekompanee/apple_core/wiki
135
+ rubygems_mfa_required: 'true'
139
136
  post_install_message:
140
137
  rdoc_options: []
141
138
  require_paths:
@@ -151,8 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
148
  - !ruby/object:Gem::Version
152
149
  version: '0'
153
150
  requirements: []
154
- rubyforge_project:
155
- rubygems_version: 2.7.6
151
+ rubygems_version: 3.3.7
156
152
  signing_key:
157
153
  specification_version: 4
158
154
  summary: Non-Active Support
metadata.gz.sig CHANGED
Binary file