Class: Lookbook::PreviewCollection

Inherits:
Collection show all
Defined in:
lib/lookbook/preview_collection.rb

Constant Summary

Constants included from Utils

Utils::FRONTMATTER_REGEX, Utils::POSITION_PREFIX_REGEX

Instance Attribute Summary

Attributes inherited from Collection

#path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Collection

#add, #as_tree, #find, #find_by_id, #find_by_path, #find_first, #find_next, #find_parent, #find_previous, #get, #get_or_create, #hierarchy_depth, #initialize, #items, #label, #lookup_path, #name, #ordered_entities, #position, #type, #visible_items

Constructor Details

This class inherits a constructor from Lookbook::Collection

Class Method Details

.describe_asObject



11
12
13
# File 'lib/lookbook/preview_collection.rb', line 11

def self.describe_as
  "previews"
end

Instance Method Details

#find_example(path) ⇒ Object



7
8
9
# File 'lib/lookbook/preview_collection.rb', line 7

def find_example(path)
  Lookbook::PreviewExample.all.find { |e| e.lookup_path == path }
end

#idObject



3
4
5
# File 'lib/lookbook/preview_collection.rb', line 3

def id
  generate_id("preview-collection", lookup_path || "root")
end