minimum_viable_product 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335595a0273eaaf7a6063a03ac5be1e00bce01db
|
4
|
+
data.tar.gz: ed9e7a45e2cefb1d5ef0005f683b8e86fb5d3af7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45ada1de4a1ee53db2eaa0c54df951a7cfe5ac61ead7070c78c7c77d9f3b26fde60539c2d3910618db4258fa9f0d447a3a7c86ae8803c9bbd7b652219544aaa4
|
7
|
+
data.tar.gz: c2474929bb308e44b5350f9c8df75cdd73d8837dc91dbd1d149ff617e51b4491ca233efda790df480b193c1b100f80f38059e4239a30a3ac7d0dee41babe7b84
|
@@ -1,16 +1,18 @@
|
|
1
|
-
module
|
2
|
-
|
1
|
+
module MinimumViableProduct
|
2
|
+
module Slugification
|
3
|
+
extend ActiveSupport::Concern
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
module ClassMethods
|
6
|
+
def slugify(name, opts={})
|
7
|
+
_opts = opts.reverse_merge(:if => lambda{ |obj| obj.send("#{name}_changed?".to_sym) })
|
8
|
+
before_validation -> { self.slug = slugify(self.send(name.to_sym)) }, _opts
|
9
|
+
end
|
8
10
|
end
|
9
|
-
end
|
10
11
|
|
11
|
-
|
12
|
+
private
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
def slugify(str)
|
15
|
+
str.gsub(/\s/,'_').dasherize.downcase
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|