Class: Locomotive::Mounter::Reader::Api::PagesReader

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/mounter/reader/api/pages_reader.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#items, #runner

Instance Method Summary collapse

Methods inherited from Base

#add_content_asset, #get, #mounting_point

Constructor Details

#initialize(runner) ⇒ PagesReader

Returns a new instance of PagesReader.



10
11
12
13
# File 'lib/locomotive/mounter/reader/api/pages_reader.rb', line 10

def initialize(runner)
  self.pages = {}
  super
end

Instance Attribute Details

#pagesObject

Returns the value of attribute pages.



8
9
10
# File 'lib/locomotive/mounter/reader/api/pages_reader.rb', line 8

def pages
  @pages
end

Instance Method Details

#readHash

Build the tree of pages based on the filesystem structure

Returns:

  • (Hash)

    The pages organized as a Hash (using the fullpath as the key)



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/locomotive/mounter/reader/api/pages_reader.rb', line 19

def read
  super

  self.fetch

  index = self.pages['index']

  self.build_relationships(index, self.pages_to_list)

  # Locomotive::Mounter.with_locale(:en) { self.to_s } # DEBUG

  # self.to_s

  self.pages
end