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 +4 -4
- data/lib/onebox.rb +1 -0
- data/lib/onebox/helpers.rb +5 -1
- data/lib/onebox/version.rb +1 -1
- data/onebox.gemspec +1 -0
- data/spec/lib/onebox/helpers_spec.rb +16 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7ab04f20175f2f5178aeff589be9de5a3c6efbf
|
4
|
+
data.tar.gz: 30c66d325d2a5f48124dda00297da95373ff2a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4174a3df1a3af3bb4ef2c3e1604bd06102128d1ec8557bf8bef70f670f47e65015f3764cd49dfc4b6d1638d63f07cdbc1f79a267ca4208a88d66f8a560c2088e
|
7
|
+
data.tar.gz: bc7fcc8ecdf0b816f64f0ccd37a40841a37b0f0d8aa282fb5a7f3239e18a8929b8a3b321143373f33d5ad547eeccc9c6626a29adfbc6ed7c818d2d4a2cd1b317
|
data/lib/onebox.rb
CHANGED
data/lib/onebox/helpers.rb
CHANGED
@@ -57,7 +57,11 @@ module Onebox
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def self.blank?(value)
|
60
|
-
value.respond_to?(:
|
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)
|
data/lib/onebox/version.rb
CHANGED
data/onebox.gemspec
CHANGED
@@ -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
|
+
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-
|
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.
|
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:
|