class UrlScraper::Object

The UrlScraper::Object is a Hash with method accessors for all detected Open Graph attributes.

Constants

MANDATORY_ATTRIBUTES

Public Instance Methods

schema() click to toggle source

The schema under which this particular object lies. May be any of the keys of the TYPES constant.

# File lib/url_scraper.rb, line 89
def schema
  UrlScraper::TYPES.each_pair do |schema, types|
    return schema if types.include?(self.type)
  end
  nil
end
type() click to toggle source

The object type.

# File lib/url_scraper.rb, line 83
def type
  self['type']
end
valid?() click to toggle source

If the Open Graph information for this object doesn't contain the mandatory attributes, this will be false.

# File lib/url_scraper.rb, line 110
def valid?
  MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}
  true
end