glimmer 2.5.1 → 2.5.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: a3ac1b24375105a448fda7392e89fa7308de9e36eb658f22bf4ace5fc408e8a9
4
- data.tar.gz: 03e8b1c161f2113178e21485706911a07ce26eeec84cff373f26b334735709f1
3
+ metadata.gz: 3f5103731be03f760a5835564ba6f3be84d2861b9a9c0c6f82fb854070ae3075
4
+ data.tar.gz: fce2ab6404b29c93cb068a7e779c32c3a2d4f6abc209468c536acb1413e8cd39
5
5
  SHA512:
6
- metadata.gz: 1cdb1f83dddda3dd0deedf52eb439413565ef73201b3c235d351309e03c6b3818c560200130a8b6bb4556451a20b2aa0ffe2a153307ac93326c6d5809aeeef7d
7
- data.tar.gz: 8946ad145ca1cb3f27c30a283b159acaef35d38d415686830daad75abbc594b399d4f408593366aab3647c100119286b172b9a152371f0afde45db15bbccab0e
6
+ metadata.gz: 67bb9d8b80194ec1004c137bc9d5b87525428b64c94063e512a3bb9291f67694440974c496785184d0b62f0d3abac62de6a662ecdff102df17009edb7bac1dd3
7
+ data.tar.gz: 767ffd76f607076b4fce5edb70f130da7d777453ca1d94a79e39f5be3c1596b28b11dc29c6e3e98c9f4d2a1133e9ff70678c52cb18805b6e898c8d0d6ec02266
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  Related Change Logs:
4
4
  - [glimmer-dsl-swt/CHANGELOG.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/CHANGELOG.md)
5
5
 
6
+ ### 2.5.3
7
+
8
+ - Provide `Observer#observe` option to tolerate not being able to extend an object for observation by silently not observing such object
9
+ - Use `Concurrent::Hash` for `ObservableModel#property_observer_hash`
10
+ - Use `Concurrent::Hash` for `ObservableHash#key_observer_hash`
11
+
6
12
  ### 2.5.1
7
13
 
8
14
  - Fix issue with referencing `OpenStruct` without 'ostruct' library being required (it now checks if `OpenStruct` is loaded first and avoids referencing otherwise).
data/README.md CHANGED
@@ -230,7 +230,7 @@ end
230
230
  ### Setup
231
231
 
232
232
  Follow these steps to author a [Glimmer](https://rubygems.org/gems/glimmer) DSL:
233
- - Add `gem 'glimmer', '~> 2.5.1'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.5.1` and add `require 'glimmer'`
233
+ - Add `gem 'glimmer', '~> 2.5.3'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.5.3` and add `require 'glimmer'`
234
234
  - Create `glimmer/dsl/[dsl_name]/dsl.rb`, which requires and adds all dynamic expressions for the [dsl_name] Glimmer DSL module as per the code shown in the previous section (or [Official DSLs](#official-dsls) as examples)
235
235
  - Create `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb` for every [expresion_name] expression needed, whether dynamic or static
236
236
 
@@ -1185,7 +1185,7 @@ Glimmer enhances observed models automatically (including array operations like
1185
1185
  This relies mainly on the Observer Design Pattern and the MVP (Model-View-Presenter) Architectural Pattern (a variation on MVC)
1186
1186
 
1187
1187
  These are the main classes concerning data-binding:
1188
- - `Glimmer::DataBinding::Observer`: Provides general observer support including unique registration and deregistration for cleanup and prevention of memory leaks. Main methods concerned are: `call`, `register` (alias: `observe`), and `unregister` (alias: `unobserve` or `deregister`)
1188
+ - `Glimmer::DataBinding::Observer`: Provides general observer support including unique registration and deregistration for cleanup and prevention of memory leaks. Main methods concerned are: `call`, `register` (alias: `observe`), and `unregister` (alias: `unobserve` or `deregister`). Passing the option `ignore_frozen: true` at the end of the args of `register` (alias: `observe`) method results in silently ignoring any passed frozen observable without raising an error (it raises an error otherwise for frozen/immutable objects).
1189
1189
  - `Glimmer::DataBinding::Observable`: General super-module for all observables. Main methods concerned are: `add_observer` and `remove_observer`
1190
1190
  - `Glimmer::DataBinding::ObservableModel`: Mixin module for any observable model (`Object`, `Struct` or `OpenStruct`) with observable attributes (observes attribute writers and `Struct`/`OpenStruct` `:[]=` method). In addition to `Observable` methods, it has a `notify_observers` method to be called when changes occur. It automatically enhances all attribute setters (ending with `=`) to notify observers on changes. Also, it automatically handles observing array attributes using `ObservableArray` appropriately so they would notify observers upon array mutation changes.
1191
1191
  - `Glimmer::DataBinding::ObservableArray`: Mixin module for any observable array collection that automatically handles notifying observers upon performing array mutation operations (e.g. `push`, `select!`, or `delete`) recursively (meaning if an array contained arrays and they changed, observers are notified). Accepts `recursive: true` option in `add_observer` method to recursively observe nested arrays all the way down. Alternatively, pass `recursive: [integer]` to limit recursion in `Array` observation to a specific number of levels beyond the first level (which is always included).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.5.3
data/glimmer.gemspec CHANGED
@@ -1,90 +1,90 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
- # stub: glimmer 2.5.1 ruby lib
6
-
7
- Gem::Specification.new do |s|
8
- s.name = "glimmer".freeze
9
- s.version = "2.5.1"
10
-
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib".freeze]
13
- s.authors = ["AndyMaleh".freeze]
14
- s.date = "2021-11-20"
15
- s.description = "Glimmer is a Ruby DSL Framework for Ruby GUI and More, consisting of a DSL Engine and an Observable / Observer / Data-Binding Library (including Observable Model, Observable Array, and Observable Hash). Used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), Glimmer DSL for Tk (Ruby Desktop Development GUI Library), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS.".freeze
16
- s.email = "andy.am@gmail.com".freeze
17
- s.extra_rdoc_files = [
18
- "CHANGELOG.md",
19
- "LICENSE.txt",
20
- "README.md"
21
- ]
22
- s.files = [
23
- "CHANGELOG.md",
24
- "CONTRIBUTING.md",
25
- "LICENSE.txt",
26
- "PROCESS.md",
27
- "README.md",
28
- "VERSION",
29
- "glimmer.gemspec",
30
- "lib/glimmer.rb",
31
- "lib/glimmer/config.rb",
32
- "lib/glimmer/data_binding/model_binding.rb",
33
- "lib/glimmer/data_binding/observable.rb",
34
- "lib/glimmer/data_binding/observable_array.rb",
35
- "lib/glimmer/data_binding/observable_hash.rb",
36
- "lib/glimmer/data_binding/observable_hashable.rb",
37
- "lib/glimmer/data_binding/observable_model.rb",
38
- "lib/glimmer/data_binding/observer.rb",
39
- "lib/glimmer/data_binding/shine.rb",
40
- "lib/glimmer/dsl/bind_expression.rb",
41
- "lib/glimmer/dsl/engine.rb",
42
- "lib/glimmer/dsl/expression.rb",
43
- "lib/glimmer/dsl/expression_handler.rb",
44
- "lib/glimmer/dsl/observe_expression.rb",
45
- "lib/glimmer/dsl/parent_expression.rb",
46
- "lib/glimmer/dsl/static_expression.rb",
47
- "lib/glimmer/dsl/top_level_expression.rb",
48
- "lib/glimmer/error.rb",
49
- "lib/glimmer/ext/module.rb",
50
- "lib/glimmer/invalid_keyword_error.rb",
51
- "lib/glimmer/shim/concurrent.rb"
52
- ]
53
- s.homepage = "http://github.com/AndyObtiva/glimmer".freeze
54
- s.licenses = ["MIT".freeze]
55
- s.rubygems_version = "3.2.31".freeze
56
- s.summary = "Glimmer - DSL Engine for Ruby GUI and More".freeze
57
-
58
- if s.respond_to? :specification_version then
59
- s.specification_version = 4
60
- end
61
-
62
- if s.respond_to? :add_runtime_dependency then
63
- s.add_runtime_dependency(%q<array_include_methods>.freeze, ["~> 1.4.0"])
64
- s.add_runtime_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
65
- s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
66
- s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
67
- s.add_development_dependency(%q<puts_debuggerer>.freeze, ["~> 0.13"])
68
- s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
69
- s.add_development_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
70
- s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
71
- s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
72
- s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
73
- s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
74
- s.add_development_dependency(%q<rake-tui>.freeze, ["> 0"])
75
- else
76
- s.add_dependency(%q<array_include_methods>.freeze, ["~> 1.4.0"])
77
- s.add_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
78
- s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
79
- s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
80
- s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.13"])
81
- s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
82
- s.add_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
83
- s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
84
- s.add_dependency(%q<coveralls>.freeze, [">= 0"])
85
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
86
- s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
87
- s.add_dependency(%q<rake-tui>.freeze, ["> 0"])
88
- end
89
- end
90
-
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: glimmer 2.5.3 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "glimmer".freeze
9
+ s.version = "2.5.3"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["AndyMaleh".freeze]
14
+ s.date = "2021-12-07"
15
+ s.description = "Glimmer is a Ruby DSL Framework for Ruby GUI and More, consisting of a DSL Engine and an Observable / Observer / Data-Binding Library (including Observable Model, Observable Array, and Observable Hash). Used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), Glimmer DSL for Tk (Ruby Desktop Development GUI Library), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS.".freeze
16
+ s.email = "andy.am@gmail.com".freeze
17
+ s.extra_rdoc_files = [
18
+ "CHANGELOG.md",
19
+ "LICENSE.txt",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ "CHANGELOG.md",
24
+ "CONTRIBUTING.md",
25
+ "LICENSE.txt",
26
+ "PROCESS.md",
27
+ "README.md",
28
+ "VERSION",
29
+ "glimmer.gemspec",
30
+ "lib/glimmer.rb",
31
+ "lib/glimmer/config.rb",
32
+ "lib/glimmer/data_binding/model_binding.rb",
33
+ "lib/glimmer/data_binding/observable.rb",
34
+ "lib/glimmer/data_binding/observable_array.rb",
35
+ "lib/glimmer/data_binding/observable_hash.rb",
36
+ "lib/glimmer/data_binding/observable_hashable.rb",
37
+ "lib/glimmer/data_binding/observable_model.rb",
38
+ "lib/glimmer/data_binding/observer.rb",
39
+ "lib/glimmer/data_binding/shine.rb",
40
+ "lib/glimmer/dsl/bind_expression.rb",
41
+ "lib/glimmer/dsl/engine.rb",
42
+ "lib/glimmer/dsl/expression.rb",
43
+ "lib/glimmer/dsl/expression_handler.rb",
44
+ "lib/glimmer/dsl/observe_expression.rb",
45
+ "lib/glimmer/dsl/parent_expression.rb",
46
+ "lib/glimmer/dsl/static_expression.rb",
47
+ "lib/glimmer/dsl/top_level_expression.rb",
48
+ "lib/glimmer/error.rb",
49
+ "lib/glimmer/ext/module.rb",
50
+ "lib/glimmer/invalid_keyword_error.rb",
51
+ "lib/glimmer/shim/concurrent.rb"
52
+ ]
53
+ s.homepage = "http://github.com/AndyObtiva/glimmer".freeze
54
+ s.licenses = ["MIT".freeze]
55
+ s.rubygems_version = "3.2.22".freeze
56
+ s.summary = "Glimmer - DSL Engine for Ruby GUI and More".freeze
57
+
58
+ if s.respond_to? :specification_version then
59
+ s.specification_version = 4
60
+ end
61
+
62
+ if s.respond_to? :add_runtime_dependency then
63
+ s.add_runtime_dependency(%q<array_include_methods>.freeze, ["~> 1.4.0"])
64
+ s.add_runtime_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
65
+ s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
66
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
67
+ s.add_development_dependency(%q<puts_debuggerer>.freeze, ["~> 0.13"])
68
+ s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
69
+ s.add_development_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
70
+ s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
71
+ s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
72
+ s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
73
+ s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
74
+ s.add_development_dependency(%q<rake-tui>.freeze, ["> 0"])
75
+ else
76
+ s.add_dependency(%q<array_include_methods>.freeze, ["~> 1.4.0"])
77
+ s.add_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
78
+ s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
79
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
80
+ s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.13"])
81
+ s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
82
+ s.add_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
83
+ s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
84
+ s.add_dependency(%q<coveralls>.freeze, [">= 0"])
85
+ s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
86
+ s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
87
+ s.add_dependency(%q<rake-tui>.freeze, ["> 0"])
88
+ end
89
+ end
90
+
@@ -51,7 +51,7 @@ module Glimmer
51
51
  element_properties = element_properties.flatten.compact.uniq
52
52
  return observer if has_observer?(observer) && has_observer_element_properties?(observer, element_properties)
53
53
  property_observer_list[observer] = options
54
- observer_element_properties[observer] = element_properties_for(observer) + Concurrent::Set.new(element_properties)
54
+ observer_element_properties[observer] = Concurrent::Set.new(Concurrent::Array.new(element_properties_for(observer).to_a) + Concurrent::Array.new(element_properties)) # converting to Array as a workaround to jruby-9.3.2.0 issue TODO remove this workaround when no longer needed
55
55
  if !options.empty? && options[:recursive].is_a?(Integer)
56
56
  options = options.clone
57
57
  options[:recursive] = options[:recursive] - 1
@@ -97,7 +97,7 @@ module Glimmer
97
97
  element_properties = element_properties.flatten.compact.uniq
98
98
  if !element_properties.empty?
99
99
  old_element_properties = element_properties_for(observer)
100
- observer_element_properties[observer] = element_properties_for(observer) - Concurrent::Set.new(element_properties)
100
+ observer_element_properties[observer] = Concurrent::Set.new(Concurrent::Array.new(element_properties_for(observer).to_a) - Concurrent::Array.new(element_properties)) # TODO remove this workaround when no longer needed (it is for jruby-9.3.2.0 issue)
101
101
  each { |element| element_properties.each { |property| observer.unobserve(element, property) } }
102
102
  end
103
103
  if element_properties_for(observer).empty?
@@ -84,7 +84,7 @@ module Glimmer
84
84
  end
85
85
 
86
86
  def key_observer_hash
87
- @key_observers ||= Hash.new
87
+ @key_observers ||= Concurrent::Hash.new
88
88
  end
89
89
 
90
90
  def key_observer_list(key)
@@ -93,7 +93,7 @@ module Glimmer
93
93
  end
94
94
 
95
95
  def property_observer_hash
96
- @property_observers ||= Hash.new
96
+ @property_observers ||= Concurrent::Hash.new
97
97
  end
98
98
 
99
99
  def property_observer_list(property_name)
@@ -83,7 +83,9 @@ module Glimmer
83
83
  # registers observer in an observable on args usually containing a property and options (optional)
84
84
  # observer maintains registration list to unregister later
85
85
  def observe(observable, *args)
86
+ options = args.last.is_a?(Hash) ? args.last : {}
86
87
  return if observable.nil?
88
+ return if options[:ignore_frozen] && observable.frozen?
87
89
  unless observable.is_a?(Observable)
88
90
  # TODO refactor code to be more smart/polymorphic/automated and honor open/closed principle (e.g. for SomeClass, search if there is ObservableSomeClass)
89
91
  if observable.is_a?(Array)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-20 00:00:00.000000000 Z
11
+ date: 2021-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: array_include_methods
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  - !ruby/object:Gem::Version
267
267
  version: '0'
268
268
  requirements: []
269
- rubygems_version: 3.2.31
269
+ rubygems_version: 3.2.22
270
270
  signing_key:
271
271
  specification_version: 4
272
272
  summary: Glimmer - DSL Engine for Ruby GUI and More