Skip to content

Commit

Permalink
Have ObserveExpression support passing an arbitrary number of argum…
Browse files Browse the repository at this point in the history
…ents (not just the object and attribute) to support newer options from the Glimmer DSL like `recursive: true`
  • Loading branch information
AndyObtiva committed Dec 20, 2023
1 parent af9e347 commit 8e18ed3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.0.2
ruby-3.2.1
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Related Change Logs:
- [glimmer-dsl-swt/CHANGELOG.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/CHANGELOG.md)

### 2.7.4

- Have `ObserveExpression` support passing an arbitrary number of arguments (not just the object and attribute) to support newer options from the Glimmer DSL like `recursive: true`

### 2.7.3

- Support case-insensitive static expressions
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [<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.3
# [<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.4
## DSL Framework for Ruby GUI and More
[![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
[![rspec](https://github.com/AndyObtiva/glimmer/workflows/rspec/badge.svg)](https://github.com/AndyObtiva/glimmer/actions?query=workflow%3Arspec)
Expand Down Expand Up @@ -265,7 +265,7 @@ end
### Setup

Follow these steps to author a [Glimmer](https://rubygems.org/gems/glimmer) DSL:
- Add `gem 'glimmer', '~> 2.7.3'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.7.3` and add `require 'glimmer'`
- Add `gem 'glimmer', '~> 2.7.4'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.7.4` and add `require 'glimmer'`
- 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)
- Create `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb` for every [expresion_name] expression needed, whether dynamic or static

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ unless jeweler_required.nil?
gem.homepage = "http://github.com/AndyObtiva/glimmer"
gem.license = "MIT"
gem.summary = %Q{Glimmer - DSL Framework for Ruby GUI and More}
gem.description = %Q{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 Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), 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 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.}
gem.description = %Q{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 Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), 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.}
gem.email = "andy.am@gmail.com"
gem.authors = ["AndyMaleh"]
# gem.executables = ['glimmer', 'girb'] # moved to glimmer-dsl-swt for now
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.3
2.7.4
53 changes: 18 additions & 35 deletions glimmer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: glimmer 2.7.3 ruby lib
# stub: glimmer 2.7.4 ruby lib

Gem::Specification.new do |s|
s.name = "glimmer".freeze
s.version = "2.7.3"
s.version = "2.7.4".freeze

s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["AndyMaleh".freeze]
s.date = "2022-03-26"
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 LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), 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 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
s.date = "2023-12-20"
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 Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), 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
s.email = "andy.am@gmail.com".freeze
s.extra_rdoc_files = [
"CHANGELOG.md",
Expand Down Expand Up @@ -53,39 +53,22 @@ Gem::Specification.new do |s|
]
s.homepage = "http://github.com/AndyObtiva/glimmer".freeze
s.licenses = ["MIT".freeze]
s.rubygems_version = "3.3.1".freeze
s.rubygems_version = "3.5.1".freeze
s.summary = "Glimmer - DSL Framework for Ruby GUI and More".freeze

if s.respond_to? :specification_version then
s.specification_version = 4
end
s.specification_version = 4

if s.respond_to? :add_runtime_dependency then
s.add_runtime_dependency(%q<array_include_methods>.freeze, ["~> 1.4.0"])
s.add_runtime_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
s.add_development_dependency(%q<puts_debuggerer>.freeze, ["~> 0.13"])
s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
s.add_development_dependency(%q<rake-tui>.freeze, ["> 0"])
else
s.add_dependency(%q<array_include_methods>.freeze, ["~> 1.4.0"])
s.add_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.13"])
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
s.add_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
s.add_dependency(%q<coveralls>.freeze, [">= 0"])
s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
s.add_dependency(%q<rake-tui>.freeze, ["> 0"])
end
s.add_runtime_dependency(%q<array_include_methods>.freeze, ["~> 1.4.0".freeze])
s.add_runtime_dependency(%q<facets>.freeze, [">= 3.1.0".freeze, "< 4.0.0".freeze])
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0".freeze])
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0".freeze])
s.add_development_dependency(%q<puts_debuggerer>.freeze, ["~> 0.13".freeze])
s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0".freeze, "< 14.0.0".freeze])
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.0.0".freeze, "< 3.0.0".freeze])
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1".freeze, "< 7.0.0".freeze])
s.add_development_dependency(%q<coveralls>.freeze, [">= 0".freeze])
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1".freeze])
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0".freeze])
s.add_development_dependency(%q<rake-tui>.freeze, ["> 0".freeze])
end

8 changes: 4 additions & 4 deletions lib/glimmer/dsl/observe_expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ module ObserveExpression
def can_interpret?(parent, keyword, *args, &block)
keyword == 'observe' and
block_given? and
(args.size == 2) and
textual?(args[1])
(args.size >= 1) and
(args[1].nil? || textual?(args[1]))
end

def interpret(parent, keyword, *args, &block)
observer = DataBinding::Observer.proc(&block)
if args[1].to_s.match(REGEX_NESTED_OR_INDEXED_PROPERTY)
observer_registration = observer.observe(DataBinding::ModelBinding.new(args[0], args[1]))
observer_registration = observer.observe(DataBinding::ModelBinding.new(*args))
else
observer_registration = observer.observe(args[0], args[1])
observer_registration = observer.observe(*args)
end
observer_registration
end
Expand Down

0 comments on commit 8e18ed3

Please sign in to comment.