Sha256: 8d67f2ba2fde1b57f8145f6a66539148a59b225ab4c6b06cb16074f6b8ac903c
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
module Lookbook class PreviewGroup < Entity include Navigable attr_reader :examples, :preview def initialize(name, examples, preview) @name = Utils.name(name) @examples = PreviewExampleCollection.new(examples) @preview = preview @lookup_path = "#{parent.lookup_path}/#{@name}" end def display_options merged = {} examples.to_a.reverse.map do |example| merged.merge!(example.display_options) end merged end def components @_components ||= ComponentCollection.new(examples.flat_map(&:components).uniq(&:path)) end def search_terms [parent.label, label] end def tags(tag_name = nil) examples.flat_map { |example| example.tags(tag_name) } end def tag(tag_name = nil) tags(tag_name).first end def url_path lookbook_inspect_path(path) end def preview_path lookbook_preview_path(path) end def type :group end alias_method :parent, :preview end end
Version data entries
4 entries across 4 versions & 1 rubygems