monadt 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/monadt/adt.rb +3 -3
- 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: 863be54459ee08e42d9a2682104719735b724da2
|
4
|
+
data.tar.gz: fa751eb65fb7a10fc6863d5f16cf037c65353e69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c198edcb1743883fab715e7050c7e31a3b33cb774c10e3620eab2026c14ebc49800e8fbcd0e3a48d7c8820a121f1cda9405135bec22373c7ee7ebb280077878
|
7
|
+
data.tar.gz: 4b2ede1a7d701e3283c87c74d9b6a0214c8c1155accd54738eb71d69a5f9a17dd77a3ffc5989b2df3c9e9ecd93b239414a4930f4408210bb45072e8406f8b51e
|
data/lib/monadt/adt.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_support/inflector'
|
2
2
|
|
3
3
|
AdtPattern = Struct.new :klass, :lambda
|
4
4
|
|
@@ -13,10 +13,10 @@ end
|
|
13
13
|
|
14
14
|
def decorate_adt(klass)
|
15
15
|
klass.constants.each do |v|
|
16
|
-
name = v.to_s.
|
16
|
+
name = v.to_s.underscore
|
17
17
|
const = klass.const_get v
|
18
18
|
klass.constants.each do |is_v|
|
19
|
-
is_name = is_v.to_s.
|
19
|
+
is_name = is_v.to_s.underscore
|
20
20
|
ret = is_v == v
|
21
21
|
const.class_eval do
|
22
22
|
define_method "is_#{is_name}?" do ret end
|