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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 654dec713823e241d3ccc401f8f5e53c0035e1f2
4
- data.tar.gz: 88c02c75a51ab31e3031e71ca88be9e23ba0b6f4
3
+ metadata.gz: 11cf021d0592289c3cba03e2e9168397b17bf952
4
+ data.tar.gz: 873d56f6a10e21bba990f1be63ea750b811766ae
5
5
  SHA512:
6
- metadata.gz: 63405ff7a926dbeec2abcd213477ad10190b3499b3d3ef19f4830a8f2bfc43d9bc6b5234fd9041ccf0e1e08b32684c7c91324ee9c07f3469451da1a70af56312
7
- data.tar.gz: 781938ab67575c945ab97b20bb88431eef8013e9e35b9c80381b09447162986c351e0482c31f04c674d3e052ba95c1b8695cceafda1c3df1ef4ca24611b64240
6
+ metadata.gz: 283a2b8210c2ba9f71aee43eacc7e66e2896aebb1c1d9d68ebf1284c85d78bd083ddb83c3b6643411b4e575667aae463d1b5061d1a2f1e880ce3f0c4d6d0b3ea
7
+ data.tar.gz: cb3cc71b303e6845352d9e934c4dda1f9aee8451c8a24c9df30b0ab808c5cc65188e1c1851fe58a5d477791f48cbfa82eca98e16afc52937baecc634359df327
@@ -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 / ideal_description_gaussian_value
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.0
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?
@@ -1,3 +1,3 @@
1
1
  module LinkThumbnailer
2
- VERSION = '3.1.1'
2
+ VERSION = '3.1.2'
3
3
  end
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.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-03-05 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport