such 0.3.0 → 0.4.0
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 +4 -4
- data/README.rdoc +2 -2
- data/lib/such.rb +4 -2
- data/lib/such/such.rb +4 -4
- data/lib/such/thing.rb +13 -12
- data/lib/such/things.rb +1 -1
- metadata +4 -5
- data/lib/such/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69f8edd38b0a7e373c70c896c47a08c629af311a
|
4
|
+
data.tar.gz: 72b897561c138e4efc85facdc39300f5b27a3386
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9f866da5f5971f67cee50008942332fcdb2e3377b81ba4e7ee30d0b5dc1ed3ef223e7706a8f4f0627bdfe3b65dd57a188c69ea167ee3b11f4ebe803263caf08
|
7
|
+
data.tar.gz: 0452ec9e456484ec83b53103c766288e71c1d9d12ca38b63d4d745af3ae578a797263462dfacf61f5505757299e8e0937b99ed2af0ad5574aefa16374d5ccf2b
|
data/README.rdoc
CHANGED
@@ -59,7 +59,7 @@ One can configure Symbol keys to represent metadata about a widget:
|
|
59
59
|
)
|
60
60
|
|
61
61
|
The examples in this repository are reworks of the examples given in
|
62
|
-
ZetCode.com[http://zetcode.com/gui/rubygtk/].
|
62
|
+
ZetCode.com[http://zetcode.com/gui/rubygtk/] (back in 2015).
|
63
63
|
|
64
64
|
=== Features:
|
65
65
|
|
@@ -84,7 +84,7 @@ Such::Part module link:lib/such/part.rb
|
|
84
84
|
|
85
85
|
(The MIT License)
|
86
86
|
|
87
|
-
Copyright (c)
|
87
|
+
Copyright (c) 2017
|
88
88
|
|
89
89
|
Permission is hereby granted, free of charge, to any person obtaining
|
90
90
|
a copy of this software and associated documentation files (the
|
data/lib/such.rb
CHANGED
data/lib/such/such.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module Such
|
2
2
|
def self.subclass(clss, sprclss="Gtk::#{clss}", body='include Such::Thing')
|
3
3
|
code = <<-CODE
|
4
|
-
class #{clss} < #{sprclss}
|
5
|
-
|
6
|
-
end
|
4
|
+
class #{clss} < #{sprclss}
|
5
|
+
#{body}
|
6
|
+
end
|
7
7
|
CODE
|
8
8
|
begin
|
9
9
|
eval code
|
10
10
|
rescue Exception
|
11
|
-
|
11
|
+
$stderr.puts code if $VERBOSE
|
12
12
|
raise $!
|
13
13
|
end
|
14
14
|
end
|
data/lib/such/thing.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Such
|
2
2
|
module Thing
|
3
|
-
INTOS = [:set_submenu, :pack_start, :append, :add] # TODO:
|
3
|
+
INTOS = [:set_submenu, :pack_start, :append, :add] # TODO:TK!?
|
4
4
|
|
5
5
|
PARAMETERS = {}
|
6
6
|
def self.configure(conf)
|
@@ -57,15 +57,19 @@ module Such
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def self.which_method(container, methods=INTOS)
|
60
|
-
methods.
|
61
|
-
raise "Don't know how to put into #{container.class}."
|
60
|
+
mthd = methods.detect{|m| container.respond_to?(m)}
|
61
|
+
raise "Don't know how to put into #{container.class}." if mthd.nil?
|
62
|
+
return mthd
|
62
63
|
end
|
63
64
|
|
64
65
|
def self.into(obj, container=nil, mthd=nil, *args)
|
65
66
|
if container
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
if mthd
|
68
|
+
unless mthd.class==Symbol and container.respond_to?(mthd)
|
69
|
+
raise "Need container & method. Got #{container.class}##{mthd}(#{obj.class}...)"
|
70
|
+
end
|
71
|
+
else
|
72
|
+
mthd=Thing.which_method(container)
|
69
73
|
end
|
70
74
|
Thing.trace_method(container, mthd, [obj.class,*args]) if $VERBOSE
|
71
75
|
container.method(mthd).call(obj, *args)
|
@@ -81,11 +85,8 @@ module Such
|
|
81
85
|
m.call(*args)
|
82
86
|
rescue ArgumentError, TypeError
|
83
87
|
# Assume user meant to iterate. Note that the heuristic is not perfect.
|
84
|
-
$stderr.puts "# Iterated Method #{mthd}
|
88
|
+
$stderr.puts "# Iterated Method #{mthd}." if $VERBOSE
|
85
89
|
[*args].each{|arg| m.call(*arg)}
|
86
|
-
if $!.class == ArgumentError and not m.arity == 1
|
87
|
-
warn "Warning: Iterated method's arity not one."
|
88
|
-
end
|
89
90
|
end
|
90
91
|
end
|
91
92
|
|
@@ -102,11 +103,11 @@ module Such
|
|
102
103
|
return if signals.first==''
|
103
104
|
none = (signals.length==0)
|
104
105
|
if block
|
105
|
-
signals.push('clicked') if block and none # TODO:
|
106
|
+
signals.push('clicked') if block and none # TODO: TK!?
|
106
107
|
signals.each do |signal|
|
107
108
|
break if signal==''
|
108
109
|
begin
|
109
|
-
obj.signal_connect(signal){|*emits| block.call(*emits, signal)} # TODO:
|
110
|
+
obj.signal_connect(signal){|*emits| block.call(*emits, signal)} # TODO: TK!?
|
110
111
|
Thing.trace_signal(obj, signal) if $VERBOSE
|
111
112
|
rescue GLib::NoSignalError
|
112
113
|
warn "Warning: no \"#{signal}\" signal for #{obj.class}"
|
data/lib/such/things.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: such
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carlosjhr64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Wraps widgets with an alternate constructor
|
@@ -28,7 +28,6 @@ files:
|
|
28
28
|
- lib/such/such.rb
|
29
29
|
- lib/such/thing.rb
|
30
30
|
- lib/such/things.rb
|
31
|
-
- lib/such/version.rb
|
32
31
|
homepage: https://github.com/carlosjhr64/such
|
33
32
|
licenses:
|
34
33
|
- MIT
|
@@ -50,9 +49,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
49
|
- !ruby/object:Gem::Version
|
51
50
|
version: '0'
|
52
51
|
requirements:
|
53
|
-
- 'ruby: ruby 2.
|
52
|
+
- 'ruby: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]'
|
54
53
|
rubyforge_project:
|
55
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.6.11
|
56
55
|
signing_key:
|
57
56
|
specification_version: 4
|
58
57
|
summary: Wraps widgets with an alternate constructor which factors out the configuration
|
data/lib/such/version.rb
DELETED