Class: StructuredData::BreadcrumbList
- Inherits:
-
Object
- Object
- StructuredData::BreadcrumbList
- Defined in:
- lib/structured_data.rb
Instance Method Summary collapse
- #<<(item) ⇒ Object
- #dump ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ BreadcrumbList
constructor
A new instance of BreadcrumbList.
Constructor Details
#initialize ⇒ BreadcrumbList
Returns a new instance of BreadcrumbList.
68 69 70 |
# File 'lib/structured_data.rb', line 68 def initialize @items = [] end |
Instance Method Details
#<<(item) ⇒ Object
72 73 74 |
# File 'lib/structured_data.rb', line 72 def <<(item) @items << item end |
#dump ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/structured_data.rb', line 80 def dump hash = { "@context": "http://schema.org", "@type": "BreadcrumbList", } hash['itemListElement'] = items_to_hash JSON.pretty_generate(hash) end |
#empty? ⇒ Boolean
76 77 78 |
# File 'lib/structured_data.rb', line 76 def empty? @items.empty? end |