Class: EacRailsUtils::OpenGraphProtocolHelper::Entry
Instance Attribute Summary collapse
#view
Instance Method Summary
collapse
#child, #children_tags, #data=
Constructor Details
#initialize(view, parent, suffix) ⇒ Entry
Returns a new instance of Entry.
61
62
63
64
65
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 61
def initialize(view, parent, suffix)
super(view)
@parent = parent @suffix = suffix end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
59
60
61
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 59
def parent
@parent
end
|
#suffix ⇒ Object
Returns the value of attribute suffix.
59
60
61
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 59
def suffix
@suffix
end
|
Instance Method Details
#components ⇒ Object
67
68
69
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 67
def components
(parent.present? ? parent.components : []) + [suffix]
end
|
#content ⇒ Object
71
72
73
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 71
def content
view.content_for content_for_key
end
|
#content=(a_content) ⇒ Object
75
76
77
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 75
def content=(a_content)
view.content_for content_for_key, a_content.to_s
end
|
#content? ⇒ Boolean
79
80
81
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 79
def content?
view.content_for? content_for_key
end
|
#content_for_key ⇒ Object
83
84
85
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 83
def content_for_key
"ogp_#{components.join('_')}"
end
|
#property_value ⇒ Object
87
88
89
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 87
def property_value
"#{view.ogp_meta_prefix}:#{components.join(':')}"
end
|
#tag ⇒ Object
91
92
93
94
95
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 91
def tag
return ::ActiveSupport::SafeBuffer.new unless content?
view.tag(:meta, prefix: view.ogp_prefix, property: property_value, content: content)
end
|