kwstruct 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/kwstruct.rb +10 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad3e24f26b36d8bfef2d7d0970e01c5397f69cfb
|
4
|
+
data.tar.gz: f149e3d64c1374c5c9daa5aafcc0ff768b7afcdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a818ffaeb8e06b9954a4e4b3af46656e85ea5121f6e3d929e54f320516c9c3d1f7e84bd979ec659c8258333fba83d7672341572c2f6b263edd76e3da4b8f74b
|
7
|
+
data.tar.gz: b09f67e65e8861e33cd3283edc643e3e388c377e2ad3806cade0c46dbff312232d66ce5a7aa66858cfd093c378ce6c665f381c2214bab4be0099a2841a8279cc
|
data/README.md
CHANGED
data/lib/kwstruct.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
class KwStruct < Struct
|
2
|
-
VERSION = '0.
|
2
|
+
VERSION = '0.2.0'
|
3
3
|
|
4
|
-
def self.new(*members)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
def self.new(*members, &block)
|
5
|
+
super.tap do |struct_class|
|
6
|
+
struct_class.class_eval <<-RUBY
|
7
|
+
def initialize(#{members.map{|m| "#{m}: nil"}.join(', ')})
|
8
|
+
super(#{members.join(', ')})
|
9
|
+
end
|
10
|
+
RUBY
|
11
|
+
end
|
11
12
|
end
|
12
13
|
end
|
14
|
+
|