Module: SchemaDotOrg
- Defined in:
- lib/schema_dot_org.rb,
lib/schema_dot_org/offer.rb,
lib/schema_dot_org/place.rb,
lib/schema_dot_org/person.rb,
lib/schema_dot_org/comment.rb,
lib/schema_dot_org/product.rb,
lib/schema_dot_org/language.rb,
lib/schema_dot_org/web_site.rb,
lib/schema_dot_org/item_list.rb,
lib/schema_dot_org/list_item.rb,
lib/schema_dot_org/organization.rb,
lib/schema_dot_org/contact_point.rb,
lib/schema_dot_org/search_action.rb,
lib/schema_dot_org/url_validator.rb,
lib/schema_dot_org/postal_address.rb,
lib/schema_dot_org/aggregate_offer.rb,
lib/schema_dot_org/breadcrumb_list.rb,
lib/schema_dot_org/interaction_counter.rb,
lib/schema_dot_org/college_or_university.rb,
lib/schema_dot_org/discussion_forum_posting.rb
Overview
The main module for the schema-dot-org gem.
Defined Under Namespace
Modules: UrlValidator Classes: AggregateOffer, BreadcrumbList, CollegeOrUniversity, Comment, ContactPoint, DiscussionForumPosting, InteractionCounter, ItemList, Language, ListItem, Offer, Organization, Person, Place, PostalAddress, Product, SchemaType, SearchAction, WebSite
Class Method Summary collapse
-
.make_breadcrumbs(links) ⇒ BreadcrumbList
Make a BreadcrumbList from an array of links.
Class Method Details
.make_breadcrumbs(links) ⇒ BreadcrumbList
Make a BreadcrumbList from an array of links. This is a convenience method for creating a BreadcrumbList and its ListItems.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/schema_dot_org.rb', line 27 def self.(links) BreadcrumbList.new(itemListElement: links.map.with_index(1) do |link, index| url = link[:url] name = link[:name] if !url.nil? && !UrlValidator.valid_web_url?(url) raise ArgumentError, "URL is not a valid web URL: #{url}" end ListItem.new(position: index, item: url, name: name) end) end |