processing 1.1.4 → 1.1.5

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: 6ef8468c160d98ed171b6895b53b5d7f2de366412dc11016009344e84e5eeb3d
4
- data.tar.gz: c0d126f5efdca61a943ce8636e6e8de9b0f00d9c11e8fe992cf7acf4344e16ab
3
+ metadata.gz: c8f47bfbe64ef981036e63d3764e68d0136d9279f155eda380484c5e82b09c0b
4
+ data.tar.gz: 8d73f1f9a94c04ebe2050007ab2a07c9ca5febae8611373af831b9b1ab30973b
5
5
  SHA512:
6
- metadata.gz: a3bf31eac373300c0c5adbe71a43931cee89f78c90de57a77f065430e4622295f6ac94af876f542764864e4be40735a5f1fa4d3fc0e728d1fbd7baf11bc8e9c1
7
- data.tar.gz: ed6609b295154cac65f3fe1af3f48a4532421da3cac7b0846feccccfb135181e88db60bdf5b5b478f1f57c8084f230af5738cfa651cadd979aa1c72cf7cd4800
6
+ metadata.gz: f38a551e8d521bd34f3c6fd41c554f3fc95cf33fee013e40b4142580cf679078d248d2fe00c5ee84d19a2f24b8108a9bfe6541678e103a59cd5bb845d8fd8006
7
+ data.tar.gz: 9b7fe7c09c8daee0e9d7e0fb44a1e9fe66a95145f20003614492480c2325a650ec860f263062e9b9f4b7defa92a89cd98a59eca446a034f912e48a5d2a95e960
data/ChangeLog.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # processing ChangeLog
2
2
 
3
3
 
4
+ ## [v1.1.5] - 2025-01-30
5
+
6
+ - Do not define snake_case methods by default
7
+
8
+
4
9
  ## [v1.1.4] - 2025-01-27
5
10
 
6
11
  - Event blocks can be defined as methods with 'def'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.4
1
+ 1.1.5
@@ -29,12 +29,19 @@ module Processing
29
29
 
30
30
  window = Processing::Window.new(w, h) {start}
31
31
  context = namespace::Context.new window
32
- funcs = (context.methods - Object.instance_methods)
32
+
33
+ return window, context
34
+ end
35
+
36
+ # @private
37
+ def self.funcs__(context)
38
+ (context.methods - Object.instance_methods)
33
39
  .reject {_1 =~ /__$/} # methods for internal use
34
- events = to_snake_case__(EVENT_NAMES__).flatten.uniq
35
- .each.with_object({}) {|event, hash| hash[event] = -> {__send__ event}}
40
+ end
36
41
 
37
- return window, context, funcs, events
42
+ # @private
43
+ def self.events__(context)
44
+ to_snake_case__(EVENT_NAMES__).flatten.uniq.select {context.respond_to? _1}
38
45
  end
39
46
 
40
47
  # @private
data/lib/processing.rb CHANGED
@@ -2,26 +2,35 @@ require 'processing/all'
2
2
 
3
3
 
4
4
  module Processing
5
- Processing.alias_snake_case_methods__ Processing
6
-
7
- WINDOW__, CONTEXT__, funcs, events = Processing.setup__ Processing
5
+ WINDOW__, CONTEXT__ = Processing.setup__ Processing
8
6
 
9
7
  refine Object do
10
- funcs.each do |func|
8
+ context = CONTEXT__
9
+ Processing.funcs__(context).each do |func|
11
10
  define_method func do |*args, **kwargs, &block|
12
- CONTEXT__.__send__ func, *args, **kwargs, &block
11
+ context.__send__ func, *args, **kwargs, &block
13
12
  end
14
13
  end
14
+ end
15
+ end# Processing
16
+
17
+
18
+ def Processing(snake_case: false)
19
+ return Processing unless snake_case
15
20
 
16
- event_names = events.keys
17
- Object.singleton_class.define_method :method_added do |method|
18
- if event_names.include? method
19
- caller = events[method]
20
- CONTEXT__.__send__(method) {caller.call} if caller
21
+ $processing_refinements_with_snake_case ||= Module.new do
22
+ Processing.alias_snake_case_methods__ Processing
23
+
24
+ refine Object do
25
+ context = Processing::CONTEXT__
26
+ Processing.funcs__(context).each do |func|
27
+ define_method func do |*args, **kwargs, &block|
28
+ context.__send__ func, *args, **kwargs, &block
29
+ end
21
30
  end
22
31
  end
23
32
  end
24
- end# Processing
33
+ end
25
34
 
26
35
 
27
36
  begin
@@ -33,6 +42,11 @@ begin
33
42
 
34
43
  w.__send__ :begin_draw
35
44
  at_exit do
45
+ Processing.events__(c).each do |event|
46
+ m = begin method event; rescue NameError; nil end
47
+ c.__send__(event) {__send__ event} if m
48
+ end
49
+
36
50
  w.__send__ :end_draw
37
51
  Processing::App.new {w.show}.start if c.hasUserBlocks__ && !$!
38
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-26 00:00:00.000000000 Z
11
+ date: 2025-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rexml