Class: BetterSeo::DSL::TwitterCards
- Inherits:
-
Base
- Object
- Base
- BetterSeo::DSL::TwitterCards
show all
- Defined in:
- lib/better_seo/dsl/twitter_cards.rb
Constant Summary
collapse
- VALID_CARD_TYPES =
%w[summary summary_large_image app player].freeze
Instance Attribute Summary
Attributes inherited from Base
#config
Instance Method Summary
collapse
Methods inherited from Base
#build, #evaluate, #get, #initialize, #merge!, #set, #to_h
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class BetterSeo::DSL::Base
Instance Method Details
#app_id(value = nil, platform: nil) ⇒ Object
82
83
84
85
86
87
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 82
def app_id(value = nil, platform: nil)
return get(:app_id) if value.nil?
current = get(:app_id) || {}
set(:app_id, current.merge(platform => value))
end
|
#app_name(value = nil, platform: nil) ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 66
def app_name(value = nil, platform: nil)
return get(:app_name) if value.nil?
if platform
current = get(:app_name) || {}
set(:app_name, current.merge(platform => value))
else
set(:app_name, {
iphone: value,
ipad: value,
googleplay: value
})
end
end
|
#app_url(value = nil, platform: nil) ⇒ Object
89
90
91
92
93
94
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 89
def app_url(value = nil, platform: nil)
return get(:app_url) if value.nil?
current = get(:app_url) || {}
set(:app_url, current.merge(platform => value))
end
|
#card(value = nil) ⇒ Object
8
9
10
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 8
def card(value = nil)
value ? set(:card, value) : get(:card)
end
|
#creator(value = nil) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 20
def creator(value = nil)
return get(:creator) if value.nil?
value = "@#{value}" unless value.to_s.start_with?("@")
set(:creator, value)
end
|
#description(value = nil) ⇒ Object
32
33
34
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 32
def description(value = nil)
value ? set(:description, value) : get(:description)
end
|
#image(value = nil) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 36
def image(value = nil)
return get(:image) if value.nil?
if value.is_a?(Hash)
end
set(:image, value)
end
|
#image_alt(value = nil) ⇒ Object
44
45
46
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 44
def image_alt(value = nil)
value ? set(:image_alt, value) : get(:image_alt)
end
|
#player(value = nil) ⇒ Object
49
50
51
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 49
def player(value = nil)
value ? set(:player, value) : get(:player)
end
|
#player_height(value = nil) ⇒ Object
57
58
59
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 57
def player_height(value = nil)
value ? set(:player_height, value) : get(:player_height)
end
|
#player_stream(value = nil) ⇒ Object
61
62
63
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 61
def player_stream(value = nil)
value ? set(:player_stream, value) : get(:player_stream)
end
|
#player_width(value = nil) ⇒ Object
53
54
55
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 53
def player_width(value = nil)
value ? set(:player_width, value) : get(:player_width)
end
|
#site(value = nil) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 12
def site(value = nil)
return get(:site) if value.nil?
value = "@#{value}" unless value.to_s.start_with?("@")
set(:site, value)
end
|
#title(value = nil) ⇒ Object
28
29
30
|
# File 'lib/better_seo/dsl/twitter_cards.rb', line 28
def title(value = nil)
value ? set(:title, value) : get(:title)
end
|