Class: Lookbook::PreviewGroup

Inherits:
Object
  • Object
show all
Includes:
Taggable
Defined in:
lib/lookbook/preview_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Taggable

#code_object, #lookbook_group, #lookbook_hidden?, #lookbook_label, #lookbook_notes

Constructor Details

#initialize(name, preview, examples) ⇒ PreviewGroup



7
8
9
10
11
# File 'lib/lookbook/preview_group.rb', line 7

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

Instance Attribute Details

#examplesObject (readonly)

Returns the value of attribute examples.



5
6
7
# File 'lib/lookbook/preview_group.rb', line 5

def examples
  @examples
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/lookbook/preview_group.rb', line 5

def name
  @name
end

Instance Method Details

#hierarchy_depthObject



33
34
35
# File 'lib/lookbook/preview_group.rb', line 33

def hierarchy_depth
  @preview.lookbook_hierarchy_depth + 1
end

#idObject



13
14
15
# File 'lib/lookbook/preview_group.rb', line 13

def id
  path.underscore.tr("_", "-")
end

#labelObject



21
22
23
# File 'lib/lookbook/preview_group.rb', line 21

def label
  name.titleize
end

#matchersObject



29
30
31
# File 'lib/lookbook/preview_group.rb', line 29

def matchers
  [@preview.label, label].map { |m| m.gsub(/\s/, "").downcase }
end

#pathObject



17
18
19
# File 'lib/lookbook/preview_group.rb', line 17

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

#typeObject



25
26
27
# File 'lib/lookbook/preview_group.rb', line 25

def type
  :group
end