onebox 1.6.4 → 1.6.5

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: f66b9e99739c4d99ed0de7f781c2103857372d39
4
- data.tar.gz: 44909b6ed468b9da999d79ab23f7edd0cdf49108
3
+ metadata.gz: d7ab04f20175f2f5178aeff589be9de5a3c6efbf
4
+ data.tar.gz: 30c66d325d2a5f48124dda00297da95373ff2a9e
5
5
  SHA512:
6
- metadata.gz: c9f604421b36115f034264bd092366e3f640087c750d38d8293e1f3db4343e74c236a60eba98b33eb5c1f06d0d5277f188515cd37c54c5b5bb7e94422c44e69e
7
- data.tar.gz: 48b59ff62e5417e353a5a5ff7daaf002475243b2e8bf71d45ee00639e271a85de6e1bf22dda104ac6a2a6c34e1f953dd3428ca17fe63d11035cb0ad3b773c7d1
6
+ metadata.gz: 4174a3df1a3af3bb4ef2c3e1604bd06102128d1ec8557bf8bef70f670f47e65015f3764cd49dfc4b6d1638d63f07cdbc1f79a267ca4208a88d66f8a560c2088e
7
+ data.tar.gz: bc7fcc8ecdf0b816f64f0ccd37a40841a37b0f0d8aa282fb5a7f3239e18a8929b8a3b321143373f33d5ad547eeccc9c6626a29adfbc6ed7c818d2d4a2cd1b317
@@ -8,6 +8,7 @@ require "moneta"
8
8
  require "cgi"
9
9
  require "net/http"
10
10
  require "digest"
11
+ require "fast_blank"
11
12
 
12
13
  module Onebox
13
14
  DEFAULTS = {
@@ -57,7 +57,11 @@ module Onebox
57
57
  end
58
58
 
59
59
  def self.blank?(value)
60
- value.respond_to?(:empty?) ? !!value.empty? || !value[/\S/] : !value
60
+ if value.respond_to?(:blank?)
61
+ value.blank?
62
+ else
63
+ value.respond_to?(:empty?) ? !!value.empty? : !value
64
+ end
61
65
  end
62
66
 
63
67
  def self.truncate(string, length = 50)
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.6.4"
2
+ VERSION = "1.6.5"
3
3
  end
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'nokogiri', '~> 1.6.6'
24
24
  spec.add_runtime_dependency 'moneta', '~> 0.8'
25
25
  spec.add_runtime_dependency 'htmlentities', '~> 4.3.4'
26
+ spec.add_runtime_dependency 'fast_blank', '>= 1.0.0'
26
27
 
27
28
  spec.add_development_dependency 'bundler', '~> 1.7'
28
29
  spec.add_development_dependency 'rake', '~> 10.4'
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Onebox::Helpers do
4
+ describe '.blank?' do
5
+ it { expect(Onebox::Helpers.blank?("")).to be(true) }
6
+ it { expect(Onebox::Helpers.blank?(" ")).to be(true) }
7
+ it { expect(Onebox::Helpers.blank?("test")).to be(false) }
8
+ it { expect(Onebox::Helpers.blank?(["test", "testing"])).to be(false) }
9
+ it { expect(Onebox::Helpers.blank?([])).to be(true) }
10
+ it { expect(Onebox::Helpers.blank?({})).to be(true) }
11
+ it { expect(Onebox::Helpers.blank?({a: 'test'})).to be(false) }
12
+ it { expect(Onebox::Helpers.blank?(nil)).to be(true) }
13
+ it { expect(Onebox::Helpers.blank?(true)).to be(false) }
14
+ it { expect(Onebox::Helpers.blank?(false)).to be(true) }
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.4
4
+ version: 1.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-12-14 00:00:00.000000000 Z
13
+ date: 2016-12-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -82,6 +82,20 @@ dependencies:
82
82
  - - "~>"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 4.3.4
85
+ - !ruby/object:Gem::Dependency
86
+ name: fast_blank
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 1.0.0
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 1.0.0
85
99
  - !ruby/object:Gem::Dependency
86
100
  name: bundler
87
101
  requirement: !ruby/object:Gem::Requirement
@@ -399,6 +413,7 @@ files:
399
413
  - spec/lib/onebox/engine/youku_onebox_spec.rb
400
414
  - spec/lib/onebox/engine/youtube_onebox_spec.rb
401
415
  - spec/lib/onebox/engine_spec.rb
416
+ - spec/lib/onebox/helpers_spec.rb
402
417
  - spec/lib/onebox/layout_spec.rb
403
418
  - spec/lib/onebox/matcher_spec.rb
404
419
  - spec/lib/onebox/preview_spec.rb
@@ -449,7 +464,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
449
464
  version: '0'
450
465
  requirements: []
451
466
  rubyforge_project:
452
- rubygems_version: 2.6.7
467
+ rubygems_version: 2.5.2
453
468
  signing_key:
454
469
  specification_version: 4
455
470
  summary: A gem for turning URLs into previews.
@@ -505,6 +520,7 @@ test_files:
505
520
  - spec/lib/onebox/engine/youku_onebox_spec.rb
506
521
  - spec/lib/onebox/engine/youtube_onebox_spec.rb
507
522
  - spec/lib/onebox/engine_spec.rb
523
+ - spec/lib/onebox/helpers_spec.rb
508
524
  - spec/lib/onebox/layout_spec.rb
509
525
  - spec/lib/onebox/matcher_spec.rb
510
526
  - spec/lib/onebox/preview_spec.rb
@@ -512,4 +528,3 @@ test_files:
512
528
  - spec/lib/onebox_spec.rb
513
529
  - spec/spec_helper.rb
514
530
  - spec/support/html_spec_helper.rb
515
- has_rdoc: