furltility-activeresource 0.0.3 → 0.0.4
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 +4 -4
- data/build.sh +1 -1
- data/furltility-activeresource.gemspec +1 -1
- data/lib/furltility-activeresource.rb +20 -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: 638edad6eff83664b4f61158d5f8611a05c9f0c5
|
4
|
+
data.tar.gz: 2f1addac8c2a3e654c918dab2fb4e3ea417d833d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86b37bc1e5c5afe2d2b77367b705480e577586f0bbe6945b25e15751e6c251ce6efd9c21dcd368aadeecac95ec19a0455ea6a98fd53de39177b5f995ea2ad3e4
|
7
|
+
data.tar.gz: 20c57108ebe7e35e8b0b5e1a4f931f2477e08543460ee93a1afa9feeb23484f2046ce2b479027cdc4a70a840e3f8630c4b2597d0b16e7cb3b759df048ce3a3a9
|
data/build.sh
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "furltility-activeresource"
|
6
|
-
gem.version = "0.0.
|
6
|
+
gem.version = "0.0.4"
|
7
7
|
gem.date = "2018-08-17"
|
8
8
|
gem.summary = "Friendly URLs"
|
9
9
|
gem.description = "A simple yet very effective library to get awesome-looking URLs in Ruby on Rails with ActiveResource, without a database table to handle it."
|
@@ -5,18 +5,35 @@ module FurltilityActiveResource
|
|
5
5
|
module ActiveResource
|
6
6
|
|
7
7
|
module ActMacro
|
8
|
-
def furltility
|
8
|
+
def furltility furl_field_met = :furl_field, options = {}
|
9
9
|
|
10
10
|
define_method :to_param do
|
11
11
|
param = id.to_i.to_s
|
12
12
|
if respond_to?(furl_field_met) && furl_field = send(furl_field_met)
|
13
|
-
furl_field = furl_field.
|
13
|
+
furl_field = furl_field.force_encoding('utf-8').encode
|
14
|
+
|
15
|
+
# symbols & pics
|
16
|
+
regex = /[\u{1f300}-\u{1f5ff}]/
|
17
|
+
furl_field = furl_field.gsub regex, ''
|
18
|
+
|
19
|
+
# enclosed chars
|
20
|
+
regex = /[\u{2500}-\u{2BEF}]/ # I changed this to exclude chinese char
|
21
|
+
furl_field = furl_field.gsub regex, ""
|
22
|
+
|
23
|
+
# emoticons
|
24
|
+
regex = /[\u{1f600}-\u{1f64f}]/
|
25
|
+
furl_field = furl_field.gsub regex, ""
|
26
|
+
|
27
|
+
#dingbats
|
28
|
+
regex = /[\u{2702}-\u{27b0}]/
|
29
|
+
furl_field = furl_field.gsub regex, ""
|
30
|
+
|
31
|
+
furl_field = furl_field.to_slug.normalize.to_s
|
14
32
|
param << "-#{furl_field}" unless furl_field.blank?
|
15
33
|
end
|
16
34
|
param
|
17
35
|
end
|
18
36
|
end
|
19
|
-
|
20
37
|
end
|
21
38
|
end
|
22
39
|
end
|