Module: Chaplin::Parser

Defined in:
lib/chaplin/parser.rb,
lib/chaplin/parser/pages.rb,
lib/chaplin/parser/config.rb,
lib/chaplin/parser/router.rb,
lib/chaplin/parser/redirects.rb,
lib/chaplin/parser/api_endpoints.rb,
lib/chaplin/parser/declaration_file.rb

Defined Under Namespace

Classes: ApiEndpoints, Config, DeclarationFile, Pages, Redirects, Router

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.not_found_response(project_path) ⇒ Object



22
23
24
# File 'lib/chaplin/parser.rb', line 22

def self.not_found_response(project_path)
  parser.not_found_response(project_path)
end

.parserObject



13
14
15
# File 'lib/chaplin/parser.rb', line 13

def self.parser
  Object.new.extend(self)
end

.routes(project_path) ⇒ Object



9
10
11
# File 'lib/chaplin/parser.rb', line 9

def self.routes(project_path)
  parser.routes(project_path)
end

Instance Method Details

#not_found_response(project_path) ⇒ Object



26
27
28
29
30
# File 'lib/chaplin/parser.rb', line 26

def not_found_response(project_path)
  self.project_path = project_path
  return unless DeclarationFile.new(project_path).not_found_page
  pages[DeclarationFile.new(project_path).not_found_page]
end

#routes(project_path) ⇒ Object



17
18
19
20
# File 'lib/chaplin/parser.rb', line 17

def routes(project_path)
  self.project_path = project_path
  Router.new(routes_declaration, pages, redirects).routes
end