Class: EacRailsUtils::OpenGraphProtocolHelper::AbstractEntry
- Inherits:
-
Object
- Object
- EacRailsUtils::OpenGraphProtocolHelper::AbstractEntry
- Defined in:
- app/helpers/eac_rails_utils/open_graph_protocol_helper.rb
Instance Attribute Summary collapse
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
- #child(child_suffix) ⇒ Object
- #children_tags ⇒ Object
- #data=(a_data) ⇒ Object
-
#initialize(view) ⇒ AbstractEntry
constructor
A new instance of AbstractEntry.
Constructor Details
#initialize(view) ⇒ AbstractEntry
Returns a new instance of AbstractEntry.
29 30 31 32 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 29 def initialize(view) @view = view @children = ::ActiveSupport::HashWithIndifferentAccess.new end |
Instance Attribute Details
#view ⇒ Object (readonly)
Returns the value of attribute view.
27 28 29 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 27 def view @view end |
Instance Method Details
#child(child_suffix) ⇒ Object
34 35 36 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 34 def child(child_suffix) @children[child_suffix] ||= Entry.new(view, self, child_suffix) end |
#children_tags ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 38 def view.capture do view.concat tag @children.values.each do |child| view.concat(child.) view.concat("\n") end end end |
#data=(a_data) ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 48 def data=(a_data) if a_data.is_a?(::Hash) a_data.each { |k, v| child(k).data = v } else self.content = a_data end end |