such 0.2.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a1f3c786a6e07bf3d9a43687fbc44f118e11f46
4
- data.tar.gz: 4a0b51b1140f37f9a43b03415abafb538977085b
3
+ metadata.gz: 4afc36d6359d3c503b0d03515002407d49ea8481
4
+ data.tar.gz: 9ac2e9cfb23196cc7a4b8617e225e0d8f7acc361
5
5
  SHA512:
6
- metadata.gz: 94b8b2a0b60dfd00eac8ee02dfae7ebf8049f1901fff72835d97bf051487f4adcef0ea7bf348eaffa2a30b793b10101678f84759f2d4682aab2c9782ed77f682
7
- data.tar.gz: 9f9e48fad694bd0a870e8c2a6c0c53db6c8973080b332f518ec5cf4fbcb63e7b9c01512d11bc777372faacc21b18c32f6e37d8499fc032b3533bbd773a4860e0
6
+ metadata.gz: 6c860f4ab47f32acb9423f370ef7233f22361139c69f14f711f3c3fc1396fed3f1a57daffd4384b385995a145a9fdaf9864bd4e3ab0c17048e2edcbd43f1db8d
7
+ data.tar.gz: de85415afe96746685132700cff1c31329a606cee99ef12500c74ed37e29b585690c4f3ab370eac90f188360884a01ad8cdca957793811b08ba8910b06ba35e6
data/README.rdoc CHANGED
@@ -2,11 +2,10 @@
2
2
 
3
3
  == DESCRIPTION:
4
4
 
5
- Wraps Ruby's Gtk widgets with an alternate constructor
5
+ Wraps widgets with an alternate constructor
6
6
  which factors out the configuration and assembly procedures into metadata.
7
-
8
- And the _Such_ module can be used to wrap any class with the alternate constructor,
9
- although currently only _Gtk3_ widgets is supported.
7
+ Can be used to wrap any class with the alternate constructor,
8
+ although currently only Gtk3 widgets is supported.
10
9
 
11
10
  == SYNOPSIS:
12
11
 
@@ -78,14 +77,14 @@ ZetCode.com[http://zetcode.com/gui/rubygtk/].
78
77
  == But wait! One more thing:
79
78
 
80
79
  See link:examples/such_parts_demo in the examples directory
81
- and link:test/tc_part for hints on how to use the much poweful
80
+ and link:test/tc_part for hints on how to use the much powerful
82
81
  Such::Part module link:lib/such/part.rb
83
82
 
84
83
  == LICENSE:
85
84
 
86
85
  (The MIT License)
87
86
 
88
- Copyright (c) 2014
87
+ Copyright (c) 2015
89
88
 
90
89
  Permission is hereby granted, free of charge, to any person obtaining
91
90
  a copy of this software and associated documentation files (the
data/lib/such/such.rb CHANGED
@@ -1,9 +1,15 @@
1
1
  module Such
2
2
  def self.subclass(clss, sprclss="Gtk::#{clss}", body='include Such::Thing')
3
- eval <<-CODE
4
- class #{clss} < #{sprclss}
5
- #{body}
6
- end
3
+ code = <<-CODE
4
+ class #{clss} < #{sprclss}
5
+ #{body}
6
+ end
7
7
  CODE
8
+ begin
9
+ eval code
10
+ rescue Exception
11
+ warn code
12
+ raise $!
13
+ end
8
14
  end
9
15
  end
data/lib/such/thing.rb CHANGED
@@ -25,7 +25,7 @@ module Such
25
25
  parameters.unshift(p.downcase.to_sym)
26
26
  parameters.unshift(p.upcase.to_sym)
27
27
  else
28
- warn "Warning: Such::PARAMETERS[#{parameter}] not defined"
28
+ warn "Warning: Such::Thing::PARAMETERS[#{parameter}] not defined"
29
29
  end
30
30
  end
31
31
  end
data/lib/such/things.rb CHANGED
@@ -1,11 +1,21 @@
1
1
  module Such
2
2
  module Things
3
- def self.list(clss=Gtk::Widget)
4
- ObjectSpace.each_object(Class).select{|k| k < clss}
3
+ def self.list(klss)
4
+ ObjectSpace.each_object(Class).select{|k| k < klss}
5
+ end
6
+
7
+ def self.in(klass)
8
+ Things.list(klass).each do |clss|
9
+ begin
10
+ Such.subclass(clss.name.sub(/^.*::/, ''))
11
+ rescue Exception
12
+ warn "#{$!.class}:\t#{clss}"
13
+ end
14
+ end
5
15
  end
6
16
 
7
17
  def self.gtk_widget
8
- Things.list.each{|clss| Such.subclass(clss.name.sub('Gtk::',''))}
18
+ Things.in(Gtk::Widget)
9
19
  end
10
20
  end
11
21
  end
data/lib/such/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Such
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,21 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: such
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-07 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
- Wraps Ruby's Gtk widgets with an alternate constructor
14
+ Wraps widgets with an alternate constructor
15
15
  which factors out the configuration and assembly procedures into metadata.
16
-
17
- And the _Such_ module can be used to wrap any class with the alternate constructor,
18
- although currently only _Gtk3_ widgets is supported.
16
+ Can be used to wrap any class with the alternate constructor,
17
+ although currently only Gtk3 widgets is supported.
19
18
  email: carlosjhr64@gmail.com
20
19
  executables: []
21
20
  extensions: []
@@ -51,12 +50,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
50
  - !ruby/object:Gem::Version
52
51
  version: '0'
53
52
  requirements:
54
- - 'ruby: ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]'
53
+ - 'ruby: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]'
55
54
  rubyforge_project:
56
- rubygems_version: 2.4.1
55
+ rubygems_version: 2.4.5.1
57
56
  signing_key:
58
57
  specification_version: 4
59
- summary: Wraps Ruby's Gtk widgets with an alternate constructor which factors out
60
- the configuration and assembly procedures into metadata.
58
+ summary: Wraps widgets with an alternate constructor which factors out the configuration
59
+ and assembly procedures into metadata. Can be used to wrap any class with the alternate
60
+ constructor, although currently only Gtk3 widgets is supported.
61
61
  test_files: []
62
- has_rdoc: