Class: OpenGraphReader::Builder Private
- Inherits:
-
Object
- Object
- OpenGraphReader::Builder
- Defined in:
- lib/open_graph_reader/builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Convert a Parser::Graph into the right hierarchy of Objects attached to a Base, then validate it.
Constant Summary collapse
- KNOWN_TYPES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Well-known types from
%w(website article book profile).freeze
Instance Method Summary collapse
-
#base ⇒ Base
private
Build and return the base.
-
#initialize(parser) ⇒ Builder
constructor
private
Create a new builder.
Constructor Details
#initialize(parser) ⇒ Builder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new builder.
17 18 19 |
# File 'lib/open_graph_reader/builder.rb', line 17 def initialize parser @parser = parser end |
Instance Method Details
#base ⇒ Base
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build and return the base.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/open_graph_reader/builder.rb', line 24 def base base = Base.new type = @parser.graph.fetch("og:type", "website").downcase validate_type type @parser.graph.each do |property| build_property base, property end synthesize_required_properties base drop_empty_children base validate base base end |