class Tychus::Parsers::OpenGraphProtocolParser

Public Class Methods

new(uri) click to toggle source
# File lib/tychus/parsers/open_graph_protocol_parser.rb, line 10
def initialize(uri)
  @root_doc = 'head'
  @recipe_doc = @doc.css(root_doc)
end

Public Instance Methods

og_node_for(property) click to toggle source
# File lib/tychus/parsers/open_graph_protocol_parser.rb, line 27
def og_node_for(property)
  node = recipe_doc.css('meta[property=\"og:#{property}\"]').first
  node.attr('content')
end
parse_description() click to toggle source
# File lib/tychus/parsers/open_graph_protocol_parser.rb, line 23
def parse_description
  recipe_doc.css('meta[name="description"]').first.attr('content')
end
parse_image() click to toggle source
# File lib/tychus/parsers/open_graph_protocol_parser.rb, line 15
def parse_image
  og_node_for(:image)
end
parse_name() click to toggle source
# File lib/tychus/parsers/open_graph_protocol_parser.rb, line 19
def parse_name
  og_node_for(:title)
end