Sha256: 58ae0e4df9b015caf4c6cb2b99176e9a9027cae05da4145dbf156c98973a2bbd

Contents?: true

Size: 804 Bytes

Versions: 6

Compression:

Stored size: 804 Bytes

Contents

module Lookbook
  class PreviewGroup
    include Utils

    attr_reader :name, :examples, :preview

    def initialize(name, preview, examples)
      @name = name
      @preview = preview
      @examples = examples
    end

    def id
      generate_id(lookup_path)
    end

    def path
      "#{@preview.path}/#{name}"
    end

    def label
      name.titleize
    end

    def type
      :group
    end

    def params
      examples.map(&:params).flatten.uniq { |param| param[:name] }
    end

    def display_params
      {}
    end

    def hidden?
      false
    end

    def position
      10000
    end

    def matchers
      normalize_matchers(@preview.label, label)
    end

    def hierarchy_depth
      @preview.hierarchy_depth + 1
    end

    alias_method :lookup_path, :path
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lookbook-0.7.2.beta.3 lib/lookbook/preview_group.rb
lookbook-0.7.2.beta.2 lib/lookbook/preview_group.rb
lookbook-0.7.2.beta.1 lib/lookbook/preview_group.rb
lookbook-0.7.2.beta.0 lib/lookbook/preview_group.rb
lookbook-0.7.1 lib/lookbook/preview_group.rb
lookbook-0.7.0 lib/lookbook/preview_group.rb