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.
60
61
62
63
64
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 60
def initialize(view, parent, suffix)
super view
@parent = parent
@suffix = suffix
end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
58
59
60
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 58
def parent
@parent
end
|
#suffix ⇒ Object
Returns the value of attribute suffix.
58
59
60
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 58
def suffix
@suffix
end
|
Instance Method Details
#components ⇒ Object
66
67
68
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 66
def components
(parent.present? ? parent.components : []) + [suffix]
end
|
#content ⇒ Object
70
71
72
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 70
def content
view.content_for content_for_key
end
|
#content=(a_content) ⇒ Object
74
75
76
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 74
def content=(a_content)
view.content_for content_for_key, a_content.to_s
end
|
#content? ⇒ Boolean
78
79
80
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 78
def content?
view.content_for? content_for_key
end
|
#content_for_key ⇒ Object
82
83
84
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 82
def content_for_key
"ogp_#{components.join('_')}"
end
|
#property_value ⇒ Object
86
87
88
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 86
def property_value
"#{view.ogp_meta_prefix}:#{components.join(':')}"
end
|
#tag ⇒ Object
90
91
92
93
|
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 90
def tag
return ::ActiveSupport::SafeBuffer.new unless content?
view.tag(:meta, prefix: view.ogp_prefix, property: property_value, content: content)
end
|