glimmer 2.7.8 → 2.8.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: 9344c9d26e07e46cbc656676e2e9cf172ce9d548f8cdf656feedc8d182b6889b
4
- data.tar.gz: ed8202f9ec5f451b4a1b9a0cd827199566193a73c1003b254de572db157bf8b1
3
+ metadata.gz: 4328b442996344feac21d01f6bfb7037119bcf58268af600d562d52cf17d4ea1
4
+ data.tar.gz: 4ce40ca39815df4afd1690be4441b5c3931f58edd9760ef56c627cea82e85e50
5
5
  SHA512:
6
- metadata.gz: cda64ce7e21ae4f2ef9bf449c460c406a5bde39b177098f30129031b4c8fa25695966c34dfbfc5c3599e24c374a2240c02f833b5b831df998479102cd40e312b
7
- data.tar.gz: 2fc3aaad22c7e9f01080ece384dc4740875a1d9c81bd95a9f006316bbe1bccabb2e7fb90e99956bd33e8ac44dbdd8ce2fc16f76198713efe491d8f1e279c7bc4
6
+ metadata.gz: e359fb49eab353f21ba61728d8730e1753df920f6925d0be2ab824be24283b5e2d03951ca1e062f6585eacc830f5113dae872cebf638127a834e551659a778ef
7
+ data.tar.gz: fd0d70e4a494f5fb7b1aba169c7f2fbb337988bf8548f42be0aad0ff146546c9facfa6f472e0ee427a1701bbff8cdccf6bd4e5bf3a5ce49f38067da526d33492
data/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
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.8.0
7
+
8
+ - Support ability to interpret multiple DSL expression hierarchies, by suspending interpretation of a hierarchy, interpreting another until done, and then resuming interpretation of previous hierarchy until done too. That is done by starting a new expression hierarchy interpretation using `Glimmer::DSL::Engine::new_parent_stack` in the middle of interpreting another expression hierarchy.
9
+ - Refactor/rename `Glimmer::DSL::Engine::parent_stacks` to `Glimmer::DSL::Engine::dsl_parent_stacks` and have it include an `Array` of `Array`s of parent stacks per DSL.
10
+
11
+ ### 2.7.9
12
+
13
+ - Optimize performance of `Glimmer::DataBinding::ObservableModel#add_observer` by removing `OpenStruct` constant check.
14
+
6
15
  ### 2.7.8
7
16
 
8
17
  - Allow passing `BindExpression` only 1 argument (e.g. presenter.todos) or 1 argument + 1 hash (e.g. presenter.todos, on_read: -> {})
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 style="position: relative; top: 20px;" />](https://rubygems.org/gems/glimmer) Glimmer 2.7.8
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 style="position: relative; top: 20px;" />](https://rubygems.org/gems/glimmer) Glimmer 2.8.0
2
2
  ## DSL Framework for Ruby GUI and More
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
4
4
  [![rspec](https://github.com/AndyObtiva/glimmer/workflows/rspec/badge.svg)](https://github.com/AndyObtiva/glimmer/actions?query=workflow%3Arspec)
@@ -268,7 +268,7 @@ end
268
268
  ### Setup
269
269
 
270
270
  Follow these steps to author a [Glimmer](https://rubygems.org/gems/glimmer) DSL:
271
- - Add `gem 'glimmer', '~> 2.7.8'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.7.8` and add `require 'glimmer'`
271
+ - Add `gem 'glimmer', '~> 2.8.0'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.8.0` and add `require 'glimmer'`
272
272
  - 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)
273
273
  - Create `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb` for every [expresion_name] expression needed, whether dynamic or static
274
274
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.7.8
1
+ 2.8.0
data/glimmer.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer 2.7.8 ruby lib
5
+ # stub: glimmer 2.8.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer".freeze
9
- s.version = "2.7.8"
9
+ s.version = "2.8.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2024-07-01"
14
+ s.date = "2024-07-14"
15
15
  s.description = "Glimmer is a Ruby DSL Framework for Ruby GUI and More, consisting of a DSL Engine and a Data-Binding Library (including Observer Design Pattern, Observable Model, Observable Array, and Observable Hash). Used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Web (Ruby in the Browser Web Frontend Framework), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library and Winner of Fukuoka Ruby Award Competition 2022 Special Award), Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library), Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library), Glimmer DSL for WX (wxWidgets Ruby Desktop Development GUI Library), Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library), Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -56,8 +56,7 @@ module Glimmer
56
56
  property_observer_list(property_name) << observer
57
57
  # if property writer does not exist, add_property_writer_observers will ensure_array_object_observer only
58
58
  add_property_writer_observers(property_name, options)
59
- open_struct_loaded = !!::OpenStruct rescue false
60
- add_key_writer_observer(property_name, options) if is_a?(Struct) || (open_struct_loaded && is_a?(OpenStruct))
59
+ add_key_writer_observer(property_name, options) unless (['Struct', 'OpenStruct'] & self.class.ancestors.map(&:to_s)).empty?
61
60
  observer
62
61
  end
63
62
 
@@ -103,7 +103,7 @@ module Glimmer
103
103
 
104
104
  # Resets Glimmer's engine activity and configuration. Useful in rspec before or after blocks in tests.
105
105
  def reset
106
- parent_stacks.values.each do |a_parent_stack|
106
+ dsl_parent_stacks.values.each do |a_parent_stack|
107
107
  a_parent_stack.clear
108
108
  end
109
109
  dsl_stack.clear
@@ -230,11 +230,11 @@ module Glimmer
230
230
  def add_content(new_parent, expression, keyword, *args, &block)
231
231
  if block_given? && expression.is_a?(ParentExpression)
232
232
  dsl_stack.push(expression.class.dsl)
233
- parent_stack.push(new_parent)
233
+ push_parent_into_parent_stack(new_parent)
234
234
  begin
235
235
  expression.add_content(new_parent, keyword, *args, &block)
236
236
  ensure
237
- parent_stack.pop
237
+ pop_parent_from_parent_stack
238
238
  dsl_stack.pop
239
239
  end
240
240
  end
@@ -244,14 +244,34 @@ module Glimmer
244
244
  #
245
245
  # Parents are maintained in a stack while evaluating Glimmer DSL
246
246
  # to ensure properly ordered interpretation of DSL syntax
247
- def_delegator :parent_stack, :last, :parent
247
+ def parent
248
+ parent_stack.last
249
+ end
250
+
251
+ def push_parent_into_parent_stack(parent)
252
+ parent_stack.push(parent)
253
+ end
248
254
 
255
+ def pop_parent_from_parent_stack
256
+ parent_stack.pop
257
+ parent_stacks.pop if parent_stacks.size > 1 && parent_stacks.last.empty?
258
+ end
259
+
249
260
  def parent_stack
250
- parent_stacks[dsl] ||= Concurrent::Array.new
261
+ new_parent_stack if parent_stacks.last.nil?
262
+ parent_stacks.last
263
+ end
264
+
265
+ def new_parent_stack
266
+ parent_stacks.push(Concurrent::Array.new)
251
267
  end
252
268
 
253
269
  def parent_stacks
254
- @parent_stacks ||= Concurrent::Hash.new
270
+ dsl_parent_stacks[dsl] ||= Concurrent::Array.new # TODO insted of having one array, we need to nest it within an array of arrays
271
+ end
272
+
273
+ def dsl_parent_stacks
274
+ @dsl_parent_stacks ||= Concurrent::Hash.new
255
275
  end
256
276
 
257
277
  # Enables multiple DSLs to play well with each other when mixing together
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.7.8
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-01 00:00:00.000000000 Z
11
+ date: 2024-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: array_include_methods