class-cattr 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/lib/lib/base.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83e87f619d4c8061b483373abf95a7b15f326da2d106e5967fea92ffc93198e3
|
4
|
+
data.tar.gz: 7c9d0d74d86608899545077cbbea4458320cb0c3db9169298f46cbfd90e81034
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 387c3bf605c2e451665297427a694958a0c3fa3c6b7d29ba87fef87130dd33cf6c1eb446586703195a339a9fcdc17e62040ce94e422879f30e0a74d3facbf836
|
7
|
+
data.tar.gz: eba2ad18def2ecc2378929fbfb364e1071903eb270e040b5aca043fffa238096c5515e7d7b31ae356a1eb4aa4bfd1f4097bc98e0cd319a9be038a38000aa70d9
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/lib/lib/base.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
class Class
|
2
|
-
def cattr name = nil, value =
|
2
|
+
def cattr name = nil, value = :_nil, &block
|
3
3
|
return CattrProxy.new(self) unless name
|
4
4
|
|
5
|
-
if
|
5
|
+
if value != :_nil || block
|
6
6
|
define_singleton_method(name) do |arg = :_nil|
|
7
7
|
if arg == :_nil
|
8
8
|
CattrProxy.new(self).send(name)
|
@@ -11,7 +11,7 @@ class Class
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
if
|
14
|
+
if value != :_nil
|
15
15
|
CattrProxy.new(self).send('%s=' % name, value)
|
16
16
|
elsif block
|
17
17
|
CattrProxy.new(self).send(name, value, &block)
|