Method: OpenGraphReader.parse

Defined in:
lib/open_graph_reader.rb

.parse(html, origin = nil) ⇒ Base?

Convenience wrapper around parse! that swallows the esceptions and returns nil instead.

Parameters:

  • html (#to_s)

    A HTML document that contains an OpenGraph object.

  • origin (#to_s) (defaults to: nil)

    The source from where the given document was fetched.

Returns:

  • (Base, nil)

    The base object from which you can obtain the root objects.

See Also:



68
69
70
71
# File 'lib/open_graph_reader.rb', line 68

def self.parse html, origin = nil
  parse! html, origin
rescue NoOpenGraphDataError, InvalidObjectError
end