core-global 0.2.0 → 0.3.0

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: 5554989b8d85210df257092029af21aa849ac4a516f43d61ae59ddef316a4d06
4
- data.tar.gz: c7b130dfe7f952c7806b4f25e89ac3bf1f0a70266cd23b31d05ff7b5997ee8a4
3
+ metadata.gz: 1a033c333e9c9734f967ebd99b29b191211634a229571023cfdf17866b9fcb3d
4
+ data.tar.gz: d8ed81721a927c652e696f6eeae63a3f9306516151204b22407cbe236734ddcf
5
5
  SHA512:
6
- metadata.gz: 2d90bd2e5233c0264f374a9592ee58b2cc8950a99ac8a033108460ed4c06024fef0a4c2f6bfcf46e2f395339e5f01c1e7df0a8b5e7af01b8875280716e21ce93
7
- data.tar.gz: f369aaac296c3132e050b68877350798f566dfe883b71522602e6e07252bb43f21c1daada9a821e67508bf7f546d822315a582e892c2d3dd18d7d471275aaecb
6
+ metadata.gz: e35a7a4248f7cdc331cb34e16552f19084992a22e67ce40b5481f1f4e0824ce28b2ceceb07214aa49dd35ce639a6d795a1b3a571a9855b77c95797657f0faa40
7
+ data.tar.gz: 05bce4649eaae219f7b5031e503b4a819cca778f1a471c7fd41901fd057847664b81019027faa0a1ebfc5588e62a52eece21c4dd4ec0d89475f0fd6ca032e771
data/CHANGELOG.md CHANGED
@@ -1,38 +1,45 @@
1
- ## [v0.2.0](https://github.com/metabahn/corerb/releases/tag/2022-06-02)
1
+ ## [v0.3.0](https://github.com/bryanp/corerb/releases/tag/2023-12-24)
2
+
3
+ *released on 2023-12-24*
4
+
5
+ * `dep` [#143](https://github.com/bryanp/corerb/pull/143) Deprecate `Is::*` and `Refine::*` namespaces ([bryanp](https://github.com/bryanp))
6
+ * `dep` [#135](https://github.com/bryanp/corerb/pull/135) Remove Ruby 2 support ([bryanp](https://github.com/bryanp))
7
+
8
+ ## [v0.2.0](https://github.com/bryanp/corerb/releases/tag/2022-06-02)
2
9
 
3
10
  *released on 2022-06-02*
4
11
 
5
- * `fix` [#129](https://github.com/metabahn/corerb/pull/129) Accept all arguments in prepended finalize ([bryanp](https://github.com/bryanp))
6
- * `chg` [#118](https://github.com/metabahn/corerb/pull/118) Allow global instance builders to be overridden ([bryanp](https://github.com/bryanp))
12
+ * `fix` [#129](https://github.com/bryanp/corerb/pull/129) Accept all arguments in prepended finalize ([bryanp](https://github.com/bryanp))
13
+ * `chg` [#118](https://github.com/bryanp/corerb/pull/118) Allow global instance builders to be overridden ([bryanp](https://github.com/bryanp))
7
14
 
8
- ## [v0.1.2](https://github.com/metabahn/corerb/releases/tag/2021-11-02)
15
+ ## [v0.1.2](https://github.com/bryanp/corerb/releases/tag/2021-11-02)
9
16
 
10
17
  *released on 2021-11-02*
11
18
 
12
- * `chg` [#97](https://github.com/metabahn/corerb/pull/97) Designate internal state with leading and trailing double underscores ([bryanp](https://github.com/bryanp))
19
+ * `chg` [#97](https://github.com/bryanp/corerb/pull/97) Designate internal state with leading and trailing double underscores ([bryanp](https://github.com/bryanp))
13
20
 
14
- ## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-07-07)
21
+ ## [v0.1.0](https://github.com/bryanp/corerb/releases/tag/2021-07-07)
15
22
 
16
23
  *released on 2021-07-07*
17
24
 
18
- * `chg` [#41](https://github.com/metabahn/corerb/pull/41) Drop Ruby 2.6 support from core-global ([bryanp](https://github.com/bryanp))
25
+ * `chg` [#41](https://github.com/bryanp/corerb/pull/41) Drop Ruby 2.6 support from core-global ([bryanp](https://github.com/bryanp))
19
26
 
20
- ## [v0.0.2](https://github.com/metabahn/corerb/releases/tag/2021-06-01.1)
27
+ ## [v0.0.2](https://github.com/bryanp/corerb/releases/tag/2021-06-01.1)
21
28
 
22
29
  *released on 2021-06-01*
23
30
 
24
- * `fix` [#36](https://github.com/metabahn/corerb/pull/36) Allow globalization of basic objects ([bryanp](https://github.com/bryanp))
31
+ * `fix` [#36](https://github.com/bryanp/corerb/pull/36) Allow globalization of basic objects ([bryanp](https://github.com/bryanp))
25
32
 
26
- ## [v0.0.1](https://github.com/metabahn/corerb/releases/tag/2021-06-01)
33
+ ## [v0.0.1](https://github.com/bryanp/corerb/releases/tag/2021-06-01)
27
34
 
28
35
  *released on 2021-06-01*
29
36
 
30
- * `fix` [#35](https://github.com/metabahn/corerb/pull/35) Correctly delegate method_missing in global instances ([bryanp](https://github.com/bryanp))
37
+ * `fix` [#35](https://github.com/bryanp/corerb/pull/35) Correctly delegate method_missing in global instances ([bryanp](https://github.com/bryanp))
31
38
 
32
- ## [v0.0.0](https://github.com/metabahn/corerb/releases/tag/2021-02-10)
39
+ ## [v0.0.0](https://github.com/bryanp/corerb/releases/tag/2021-02-10)
33
40
 
34
41
  *released on 2021-02-10*
35
42
 
36
- * `add` [#4](https://github.com/metabahn/corerb/pull/4) Initial core-global behavior ([bryanp](https://github.com/bryanp))
43
+ * `add` [#4](https://github.com/bryanp/corerb/pull/4) Initial core-global behavior ([bryanp](https://github.com/bryanp))
37
44
 
38
45
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module Global
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
 
7
7
  def self.version
8
8
  VERSION
data/lib/core/global.rb CHANGED
@@ -1,9 +1,72 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "forwardable"
4
+ require "core/extension"
5
+
3
6
  module Core
7
+ # [public] Add a global instance to any object.
8
+ #
4
9
  module Global
5
10
  require_relative "global/version"
11
+
12
+ extend Core::Extension
13
+
14
+ extends :definition do
15
+ # [public] Build a global instance. This method can safely overrided on a global object and still be memoized.
16
+ #
17
+ def global
18
+ new
19
+ end
20
+
21
+ # [public] Reset the global instance.
22
+ #
23
+ def reset
24
+ remove_instance_variable(:@__global__) if defined?(@__global__)
25
+ end
26
+
27
+ def finalize(...)
28
+ singleton_class.def_delegators(:global, *public_instance_methods(false) - singleton_class.public_instance_methods(false))
29
+ end
30
+ end
31
+
32
+ extends :definition, prepend: true do
33
+ # [public] Return the current global instance.
34
+ #
35
+ def global
36
+ @__global__ ||= super
37
+ end
38
+
39
+ def method_added(name)
40
+ if instance_variable_defined?(:@__finalized__)
41
+ remove_instance_variable(:@__finalized__)
42
+ end
43
+
44
+ super
45
+ end
46
+
47
+ def method_missing(name, *args, &block)
48
+ unless defined?(@__finalized__)
49
+ finalize
50
+ end
51
+
52
+ if public_method_defined?(name)
53
+ global.__send__(name, *args, &block)
54
+ else
55
+ super
56
+ end
57
+ end
58
+
59
+ if Module.private_method_defined?(:ruby2_keywords)
60
+ ruby2_keywords(:method_missing)
61
+ end
62
+
63
+ def respond_to_missing?(name, *)
64
+ public_method_defined?(name) || super
65
+ end
66
+ end
67
+
68
+ applies do
69
+ singleton_class.extend(Forwardable)
70
+ end
6
71
  end
7
72
  end
8
-
9
- require_relative "../is/global"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core-global
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-03 00:00:00.000000000 Z
11
+ date: 2023-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: core-extension
@@ -16,16 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.3'
19
+ version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.3'
26
+ version: '0.5'
27
27
  description: Patterns for responsible global state.
28
- email: bryan@metabahn.com
28
+ email: bryan@bryanp.org
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
@@ -34,8 +34,7 @@ files:
34
34
  - LICENSE
35
35
  - lib/core/global.rb
36
36
  - lib/core/global/version.rb
37
- - lib/is/global.rb
38
- homepage: https://github.com/metabahn/corerb/
37
+ homepage: https://github.com/bryanp/corerb/
39
38
  licenses:
40
39
  - MPL-2.0
41
40
  metadata: {}
@@ -47,14 +46,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
47
46
  requirements:
48
47
  - - ">="
49
48
  - !ruby/object:Gem::Version
50
- version: '2.7'
49
+ version: '3.0'
51
50
  required_rubygems_version: !ruby/object:Gem::Requirement
52
51
  requirements:
53
52
  - - ">="
54
53
  - !ruby/object:Gem::Version
55
54
  version: '0'
56
55
  requirements: []
57
- rubygems_version: 3.3.13
56
+ rubygems_version: 3.5.1
58
57
  signing_key:
59
58
  specification_version: 4
60
59
  summary: Patterns for responsible global state.
data/lib/is/global.rb DELETED
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "forwardable"
4
-
5
- require "core/extension"
6
-
7
- module Is
8
- # [public] Adds a global instance to any object.
9
- #
10
- module Global
11
- extend Is::Extension
12
-
13
- extends :definition do
14
- # [public] Build a global instance. This method can safely overrided on a global object and still be memoized.
15
- #
16
- def global
17
- new
18
- end
19
-
20
- # [public] Reset the global instance.
21
- #
22
- def reset
23
- remove_instance_variable(:@__global__) if defined?(@__global__)
24
- end
25
-
26
- def finalize(...)
27
- singleton_class.def_delegators(:global, *public_instance_methods(false) - singleton_class.public_instance_methods(false))
28
- end
29
- end
30
-
31
- extends :definition, prepend: true do
32
- # [public] Return the current global instance.
33
- #
34
- def global
35
- @__global__ ||= super
36
- end
37
-
38
- def method_added(name)
39
- if instance_variable_defined?(:@__finalized__)
40
- remove_instance_variable(:@__finalized__)
41
- end
42
-
43
- super
44
- end
45
-
46
- def method_missing(name, *args, &block)
47
- unless defined?(@__finalized__)
48
- finalize
49
- end
50
-
51
- if public_method_defined?(name)
52
- global.__send__(name, *args, &block)
53
- else
54
- super
55
- end
56
- end
57
-
58
- if Module.private_method_defined?(:ruby2_keywords)
59
- ruby2_keywords(:method_missing)
60
- end
61
-
62
- def respond_to_missing?(name, *)
63
- public_method_defined?(name) || super
64
- end
65
- end
66
-
67
- applies do
68
- singleton_class.extend(Forwardable)
69
- end
70
- end
71
- end