Class: Adva::Static::Import::Source::Site
- Inherits:
-
Base
- Object
- Base
- Adva::Static::Import::Source::Site
show all
- Defined in:
- lib/adva/static/import/source/site.rb
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/site.rb', line 9
def recognize(paths)
paths.map { |path| new(path.delete(path).root) if path.filename == 'site' }.compact.sort end
|
Instance Method Details
#data ⇒ Object
30
31
32
|
# File 'lib/adva/static/import/source/site.rb', line 30
def data
super.merge(:sections => sections, :host => host, :name => name, :title => title)
end
|
#host ⇒ Object
18
19
20
|
# File 'lib/adva/static/import/source/site.rb', line 18
def host
@host ||= read.host || File.basename(path.root)
end
|
#name ⇒ Object
22
23
24
|
# File 'lib/adva/static/import/source/site.rb', line 22
def name
@name ||= read.name || host.titleize
end
|
#sections ⇒ Object
14
15
16
|
# File 'lib/adva/static/import/source/site.rb', line 14
def sections
@sections ||= Section.recognize(path.glob.delete_if { |path| path.filename == 'site' })
end
|
#title ⇒ Object
26
27
28
|
# File 'lib/adva/static/import/source/site.rb', line 26
def title
@title ||= read.title || name
end
|