Class: Adva::Static::Import::Source::Section
- Inherits:
-
Base
- Object
- Base
- Adva::Static::Import::Source::Section
show all
- Defined in:
- lib/adva/static/import/source/section.rb
Constant Summary
collapse
- TYPES =
[Blog, Page]
Instance Attribute Summary
Attributes inherited from Base
#path
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#<=>, #initialize, #model_name, #to_hash
Class Method Details
.recognize(paths) ⇒ Object
9
10
11
|
# File 'lib/adva/static/import/source/section.rb', line 9
def recognize(paths)
TYPES.map { |type| type.recognize(paths) }.flatten.compact.sort
end
|
Instance Method Details
#data ⇒ Object
26
27
28
|
# File 'lib/adva/static/import/source/section.rb', line 26
def data
super.merge(:name => name, :slug => slug)
end
|
#name ⇒ Object
18
19
20
|
# File 'lib/adva/static/import/source/section.rb', line 18
def name
@name ||= read.name || (root? ? 'Home' : path.filename.to_s.titleize)
end
|
#root? ⇒ Boolean
14
15
16
|
# File 'lib/adva/static/import/source/section.rb', line 14
def root?
path.root?
end
|
#slug ⇒ Object
22
23
24
|
# File 'lib/adva/static/import/source/section.rb', line 22
def slug
@slug ||= read.slug || SimpleSlugs::Slug.new(name).to_s
end
|