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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Collection

#add, #as_tree, #clear, #collapsible?, #find, #find_by_id, #find_by_path, #find_first, #find_next, #find_parent, #find_previous, #get, #get_or_create, #initialize, #items, #name, #non_empty_items, #ordered_entities, #position, #visible_items

Methods inherited from Entity

#hidden?, #hierarchy_depth, #initialize, #lookup_path, #matchers, #path, #position

Constructor Details

This class inherits a constructor from Lookbook::Collection

Class Method Details

.describe_asObject



19
20
21
# File 'lib/lookbook/preview_collection.rb', line 19

def self.describe_as
  "previews"
end

Instance Method Details

#find_example(path) ⇒ Object



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

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

#labelObject



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

def label
  "Previews"
end

#typeObject



15
16
17
# File 'lib/lookbook/preview_collection.rb', line 15

def type
  :preview_collection
end