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.
30 31 32 33 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 30 def initialize(view) @view = view @children = ::ActiveSupport::HashWithIndifferentAccess.new end |
Instance Attribute Details
#view ⇒ Object (readonly)
Returns the value of attribute view.
28 29 30 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 28 def view @view end |
Instance Method Details
#child(child_suffix) ⇒ Object
35 36 37 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 35 def child(child_suffix) @children[child_suffix] ||= Entry.new(view, self, child_suffix) end |
#children_tags ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 39 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
49 50 51 52 53 54 55 |
# File 'app/helpers/eac_rails_utils/open_graph_protocol_helper.rb', line 49 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 |