link_thumbnailer 3.1.1 → 3.1.2
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/CHANGELOG.md +22 -0
- data/lib/link_thumbnailer/graders/length.rb +2 -6
- data/lib/link_thumbnailer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11cf021d0592289c3cba03e2e9168397b17bf952
|
4
|
+
data.tar.gz: 873d56f6a10e21bba990f1be63ea750b811766ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 283a2b8210c2ba9f71aee43eacc7e66e2896aebb1c1d9d68ebf1284c85d78bd083ddb83c3b6643411b4e575667aae463d1b5061d1a2f1e880ce3f0c4d6d0b3ea
|
7
|
+
data.tar.gz: cb3cc71b303e6845352d9e934c4dda1f9aee8451c8a24c9df30b0ab808c5cc65188e1c1851fe58a5d477791f48cbfa82eca98e16afc52937baecc634359df327
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# 3.1.2
|
2
|
+
|
3
|
+
Allows to customize ideal description length
|
4
|
+
|
5
|
+
Pass the :ideal_description_length option to the Graders::Length initializer to customize
|
6
|
+
the ideal description length of a website. In the rails initializer:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
LinkThumbnailer.configure do |config|
|
10
|
+
config.graders = [
|
11
|
+
->(description) { ::LinkThumbnailer::Graders::Length.new(description, ideal_description_length: 500) },
|
12
|
+
->(description) { ::LinkThumbnailer::Graders::HtmlAttribute.new(description, :class) },
|
13
|
+
->(description) { ::LinkThumbnailer::Graders::HtmlAttribute.new(description, :id) },
|
14
|
+
->(description) { ::LinkThumbnailer::Graders::Position.new(description, weigth: 3) },
|
15
|
+
->(description) { ::LinkThumbnailer::Graders::LinkDensity.new(description) },
|
16
|
+
]
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
Will default to `120` characters. More information about how the gem manage to find the best description can be found at
|
21
|
+
http://www.codeids.com/2015/06/27/how-to-find-best-description-of-a-website-using-linkthumbnailer/
|
22
|
+
|
1
23
|
# 3.1.1
|
2
24
|
|
3
25
|
- Upgrade `video_info` gem
|
@@ -5,7 +5,7 @@ module LinkThumbnailer
|
|
5
5
|
def call
|
6
6
|
return 0.0 if too_short?
|
7
7
|
|
8
|
-
y /
|
8
|
+
y / get_gaussian_value_for(ideal_description_length)
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
@@ -23,11 +23,7 @@ module LinkThumbnailer
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def ideal_description_length
|
26
|
-
120.
|
27
|
-
end
|
28
|
-
|
29
|
-
def ideal_description_gaussian_value
|
30
|
-
4.442882938158366
|
26
|
+
options.fetch(:ideal_description_length, 120).to_f
|
31
27
|
end
|
32
28
|
|
33
29
|
def too_short?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: link_thumbnailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre-Louis Gottfrois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|