showcase 0.2.1 → 0.2.2

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: bcf0fde90d484b35c54b9cfb8ef72123de71a78d
4
- data.tar.gz: fdcc72c89960d828ab4d496974cb45c01045dc19
3
+ metadata.gz: 2793f52eea58c519b380e4a3e87c7ec768d195c1
4
+ data.tar.gz: c6c9a09255338c9f737fc2cd4ceb6b9213dbc011
5
5
  SHA512:
6
- metadata.gz: 72365b989e2d2aeef8f757cbe85607097da0a602510652d03266b6d352f4c5036164dfe81376649407f47620af7296bde6bf7f8def7edc02a31b04fbfbda644b
7
- data.tar.gz: c8774f411e41452fc643f952ed6c43413968d2246421cabce9b38d4854f23d80609d43f198328d5be234e8fb7b1f0bf96c4d1496480474044cffb3716a17cf6f
6
+ metadata.gz: 0c4d859554d4c99b6b10078328057d90a51993ea4719f680d4f81bed35ecd0a702629d97bb558cb41a03a54c4a36769bc73c5b988d51ad99a9f98a770d53d133
7
+ data.tar.gz: ff084a8d82002aab84dfa4ae740736e39808de657f8d71c804709679d3518cfa17a172e9d97b2fd5de29c785053f31c8cb5e7681bd05f06b2fbd9ff3439e2917
@@ -0,0 +1,6 @@
1
+ class FirstNonBlank
2
+ def self.find(values)
3
+ Array(values).find(&:presence)
4
+ end
5
+ end
6
+
@@ -1,3 +1,5 @@
1
+ require 'showcase/helpers/first_nonblank'
2
+
1
3
  module Showcase
2
4
  module Helpers
3
5
  class SeoMetaBuilder
@@ -8,7 +10,7 @@ module Showcase
8
10
  end
9
11
 
10
12
  def title(values, options = {})
11
- title = first_nonblank(values)
13
+ title = FirstNonBlank.find(values)
12
14
  title += options[:title_suffix] if options[:title_suffix]
13
15
 
14
16
  context.content_tag(:title, title) <<
@@ -57,12 +59,8 @@ module Showcase
57
59
 
58
60
  private
59
61
 
60
- def first_nonblank(values)
61
- Array(values).find(&:presence)
62
- end
63
-
64
62
  def seo_meta_tags(*args)
65
- value = first_nonblank(args.pop)
63
+ value = FirstNonBlank.find(args.pop)
66
64
 
67
65
  return nil unless value.present?
68
66
 
@@ -1,4 +1,5 @@
1
1
  require 'showcase/helpers/config_object'
2
+ require 'showcase/helpers/first_nonblank'
2
3
  require 'active_support/core_ext/object/to_query'
3
4
 
4
5
  module Showcase
@@ -45,7 +46,9 @@ module Showcase
45
46
  html_options = meta.html_options || {}
46
47
  params = Hash[
47
48
  settings[:params].map do |param, meta_key|
48
- values = [:"#{social}_#{meta_key}", meta_key].map { |key| meta.send(key) }
49
+ values = [:"#{social}_#{meta_key}", meta_key].map do |key|
50
+ FirstNonBlank.find(meta.send(key))
51
+ end
49
52
  [ param, values.find(&:presence) ]
50
53
  end
51
54
  ]
@@ -1,4 +1,4 @@
1
1
  module Showcase
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
4
4
 
@@ -17,16 +17,16 @@ module Showcase::Traits
17
17
  end
18
18
 
19
19
  seo do |c|
20
- c.title = 'foo'
21
- c.description 'bar'
20
+ c.title = ['', 'foo']
21
+ c.description = ['', 'bar']
22
22
  end
23
23
  end
24
24
  }
25
25
 
26
26
  describe '.seo' do
27
27
  let(:expected_options) { { title_suffix: ' - qux' } }
28
- let(:expected_description) { 'bar' }
29
- let(:expected_title) { 'foo' }
28
+ let(:expected_description) { ['', 'bar'] }
29
+ let(:expected_title) { ['', 'foo'] }
30
30
 
31
31
  before do
32
32
  Showcase::Helpers::SeoMetaBuilder.stub(:new).with(view).and_return(builder)
@@ -13,8 +13,8 @@ module Showcase::Traits
13
13
 
14
14
  share do |c|
15
15
  c.url = 'url'
16
- c.text = 'text'
17
- c.twitter_text = 'twitter text'
16
+ c.text = ['', 'text']
17
+ c.twitter_text = ['', 'twitter text']
18
18
  c.image_url = 'image'
19
19
  c.html_options = { role: 'share' }
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showcase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-23 00:00:00.000000000 Z
11
+ date: 2014-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -103,6 +103,7 @@ files:
103
103
  - lib/showcase.rb
104
104
  - lib/showcase/errors.rb
105
105
  - lib/showcase/helpers/config_object.rb
106
+ - lib/showcase/helpers/first_nonblank.rb
106
107
  - lib/showcase/helpers/html_options.rb
107
108
  - lib/showcase/helpers/module_method_builder.rb
108
109
  - lib/showcase/helpers/present.rb