Class: Lookbook::Entity
- Inherits:
-
Object
show all
- Includes:
- Utils
- Defined in:
- lib/lookbook/entity.rb
Constant Summary
Constants included
from Utils
Utils::FRONTMATTER_REGEX, Utils::POSITION_PREFIX_REGEX
Instance Method Summary
collapse
Constructor Details
#initialize(reference_path) ⇒ Entity
Returns a new instance of Entity.
5
6
7
|
# File 'lib/lookbook/entity.rb', line 5
def initialize(reference_path)
@refpath = reference_path
end
|
Instance Method Details
#hidden? ⇒ Boolean
37
38
39
|
# File 'lib/lookbook/entity.rb', line 37
def hidden?
false
end
|
#hierarchy_depth ⇒ Object
29
30
31
|
# File 'lib/lookbook/entity.rb', line 29
def hierarchy_depth
@refpath.present? ? @refpath.split("/").size : 0
end
|
#id ⇒ Object
9
10
11
|
# File 'lib/lookbook/entity.rb', line 9
def id
generate_id(lookup_path)
end
|
#label ⇒ Object
13
14
15
|
# File 'lib/lookbook/entity.rb', line 13
def label
lookup_path.split("/").last.titleize
end
|
#lookup_path ⇒ Object
Also known as:
url_path
25
26
27
|
# File 'lib/lookbook/entity.rb', line 25
def lookup_path
@lookup_path ||= to_lookup_path(@refpath)
end
|
#matchers ⇒ Object
41
42
43
|
# File 'lib/lookbook/entity.rb', line 41
def matchers
nil
end
|
#path ⇒ Object
21
22
23
|
# File 'lib/lookbook/entity.rb', line 21
def path
@refpath
end
|
#position ⇒ Object
33
34
35
|
# File 'lib/lookbook/entity.rb', line 33
def position
0
end
|
#type ⇒ Object
17
18
19
|
# File 'lib/lookbook/entity.rb', line 17
def type
:item
end
|