glimmer 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +7 -3
- data/VERSION +1 -1
- data/glimmer.gemspec +3 -3
- data/lib/glimmer/data_binding/model_binding.rb +8 -8
- data/lib/glimmer/data_binding/observable_model.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 351035b802dcf014c087c908f8481dbbf13d8479fdd1766b47e25be2177ffc98
|
4
|
+
data.tar.gz: 7960514819570b96106dcde2c71889feb0bd706dbe5803e3e62bf02c28f4c1f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f127846dc71e67d3667cd738a96f11d667718d93f28494e31414a29a6e93b323f04af33bcc022bb8a4cc96e413622209589f1f2ab2ba5efc10bf5bce6baf33f7
|
7
|
+
data.tar.gz: 6a300696cb179c0d01173fd4a652d6ef78219ad944ff2af9ef7fbfec19e9a853365631f92bae5c7b2353946a2c2e498d178f14f96ee357f61a02b872b1e17537
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
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
|
+
### 1.3.1
|
7
|
+
|
8
|
+
- Use `Concurrent::Array` instead of `Array` in `Glimmer::DataBinding::ModelBinding`
|
9
|
+
|
6
10
|
### 1.3.0
|
7
11
|
|
8
12
|
- Support the `Expression#around` hook, which executes code around both `interpret` and `add_content`
|
data/README.md
CHANGED
@@ -27,6 +27,8 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
27
27
|
- Multiple DSLs may be [mixed](#multi-dsl-support) together safely to achieve maximum expressability, composability, and productivity.
|
28
28
|
- DSLs are fully configurable, so you may activate and deactivate DSLs as per your current needs only.
|
29
29
|
|
30
|
+
Start by checking out Glimmer's original GUI DSL, which got extracted into its own gem: [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)
|
31
|
+
|
30
32
|
[**Glimmer**](https://rubygems.org/gems/glimmer) supports the following DSLs:
|
31
33
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
32
34
|
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
@@ -204,7 +206,7 @@ end
|
|
204
206
|
### Setup
|
205
207
|
|
206
208
|
Follow these steps to author a [Glimmer](https://rubygems.org/gems/glimmer) DSL:
|
207
|
-
- Add `gem 'glimmer', '~> 1.3.
|
209
|
+
- Add `gem 'glimmer', '~> 1.3.1'` to `Gemfile` and run `bundle` or run `gem install glimmer -v1.3.1` and add `require 'glimmer'`
|
208
210
|
- 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)
|
209
211
|
- Create `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb` for every [expresion_name] expression needed, whether dynamic or static
|
210
212
|
|
@@ -924,9 +926,9 @@ Glimmer app:
|
|
924
926
|
|
925
927
|
## Data-Binding Library
|
926
928
|
|
927
|
-
Data-Binding enables mapping GUI properties (like text and color) to Model attributes (like name and age).
|
929
|
+
Data-Binding enables mapping GUI properties (like text and color) to Model attributes (like name and age) for bidirectional or unidirectional synchronization and conversion as needed.
|
928
930
|
|
929
|
-
Glimmer enhances observed models automatically (including array operations like
|
931
|
+
Glimmer enhances observed models automatically (including array operations like `<<`, `delete`, and `reject!`) on first observation. As such, you get automatic observable support, including nested and computed observations. No need to change your model code to data-bind it to the view or add repetitive boilerplate modules. View data-binding is truly decoupled from model logic by being able to observe any model attribute (Ruby attribute reader/writer combo or Ruby attribute reader alone for read-only data-binding when needed)
|
930
932
|
|
931
933
|
This relies mainly on the Observer Design Pattern and the MVP (Model-View-Presenter) Architectural Pattern (a variation on MVC)
|
932
934
|
|
@@ -937,6 +939,8 @@ These are the main classes concerning data-binding:
|
|
937
939
|
- `ObservableArray`: Mixin module for any observable array collection that automatically handles notifying observers upon performing array mutation operations (e.g. `push` or `delete`)
|
938
940
|
- `ModelBinding`: a higher-level abstraction that relies on all the other observer/observable classes to support basic data-binding, nested data-binding, and computed data-binding
|
939
941
|
|
942
|
+
You may learn more from [Data-Binding](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#data-binding) and [Observer](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#observer) usage in [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)
|
943
|
+
|
940
944
|
## Glimmer Process
|
941
945
|
|
942
946
|
[Glimmer Process](PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.1
|
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 1.3.
|
5
|
+
# stub: glimmer 1.3.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer".freeze
|
9
|
-
s.version = "1.3.
|
9
|
+
s.version = "1.3.1"
|
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 = "2021-03-
|
14
|
+
s.date = "2021-03-23"
|
15
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. Used in the Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), the Glimmer DSL for Tk (Ruby Desktop Development GUI Library), the Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), the Glimmer DSL for XML (& HTML), and the Glimmer DSL for CSS.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -35,9 +35,9 @@ module Glimmer
|
|
35
35
|
@property_name_expression = property_name_expression
|
36
36
|
@binding_options = binding_options || Concurrent::Hash.new
|
37
37
|
if computed?
|
38
|
-
@computed_model_bindings = computed_by.map do |computed_by_property_expression|
|
38
|
+
@computed_model_bindings = Concurrent::Array.new(computed_by.map do |computed_by_property_expression|
|
39
39
|
self.class.new(base_model, computed_by_property_expression)
|
40
|
-
end
|
40
|
+
end)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -47,7 +47,7 @@ module Glimmer
|
|
47
47
|
|
48
48
|
# e.g. person.address.state returns [person, person.address]
|
49
49
|
def nested_models
|
50
|
-
@nested_models = [base_model]
|
50
|
+
@nested_models = Concurrent::Array.new([base_model])
|
51
51
|
model_property_names.reduce(base_model) do |reduced_model, nested_model_property_name|
|
52
52
|
if !reduced_model.nil?
|
53
53
|
invoke_property_reader(reduced_model, nested_model_property_name).tap do |new_reduced_model|
|
@@ -75,7 +75,7 @@ module Glimmer
|
|
75
75
|
# If there are any indexed property names, this returns indexes as properties.
|
76
76
|
# e.g. property name expression "addresses[1].state" gives ['addresses', '[1]', 'state']
|
77
77
|
def nested_property_names
|
78
|
-
@nested_property_names ||= property_name_expression.split(".").map {|pne| pne.match(/([^\[]+)(\[[^\]]+\])?/).to_a.drop(1)}.flatten.compact
|
78
|
+
@nested_property_names ||= Concurrent::Array.new(property_name_expression.split(".").map {|pne| pne.match(/([^\[]+)(\[[^\]]+\])?/).to_a.drop(1)}.flatten.compact)
|
79
79
|
end
|
80
80
|
|
81
81
|
# Final nested property name
|
@@ -87,7 +87,7 @@ module Glimmer
|
|
87
87
|
# Model representing nested property names
|
88
88
|
# e.g. property name expression "address.state" gives [:address]
|
89
89
|
def model_property_names
|
90
|
-
nested_property_names[0...-1]
|
90
|
+
Concurrent::Array.new(nested_property_names[0...-1])
|
91
91
|
end
|
92
92
|
|
93
93
|
def nested_property?
|
@@ -99,7 +99,7 @@ module Glimmer
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def computed_by
|
102
|
-
[@binding_options[:computed_by]].flatten.compact
|
102
|
+
Concurrent::Array.new([@binding_options[:computed_by]].flatten.compact)
|
103
103
|
end
|
104
104
|
|
105
105
|
def nested_property_observers_for(observer)
|
@@ -175,7 +175,7 @@ module Glimmer
|
|
175
175
|
|
176
176
|
def add_nested_observers(observer)
|
177
177
|
nested_property_observers = nested_property_observers_for(observer)
|
178
|
-
nested_models.zip(nested_property_names).each_with_index do |zip, i|
|
178
|
+
Concurrent::Array.new(nested_models.zip(nested_property_names)).each_with_index do |zip, i|
|
179
179
|
model, property_name = zip
|
180
180
|
nested_property_observer = nested_property_observers[property_name]
|
181
181
|
previous_index = i - 1
|
@@ -242,7 +242,7 @@ module Glimmer
|
|
242
242
|
|
243
243
|
def invoke_proc_with_exact_parameters(proc_object, *args)
|
244
244
|
return if proc_object.nil?
|
245
|
-
args = args[0...proc_object.parameters.size]
|
245
|
+
args = Concurrent::Array.new(args[0...proc_object.parameters.size])
|
246
246
|
proc_object.call(*args)
|
247
247
|
end
|
248
248
|
|
@@ -29,10 +29,12 @@ module Glimmer
|
|
29
29
|
|
30
30
|
class Notifier
|
31
31
|
include Observer
|
32
|
+
|
32
33
|
def initialize(observable_model, property_name)
|
33
34
|
@observable_model = observable_model
|
34
35
|
@property_name = property_name
|
35
36
|
end
|
37
|
+
|
36
38
|
def call(new_value=nil)
|
37
39
|
@observable_model.notify_observers(@property_name)
|
38
40
|
end
|
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: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: array_include_methods
|