Class: LibraryController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/library_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
# File 'app/controllers/library_controller.rb', line 7

def index
  dir = Dir.glob("#{Rails.root}/app/views/#{@configuration[:root_directory]}/**/*.erb").sort
  @library = Library::Librarian.new(dir, @configuration)
end

#showObject

Raises:

  • (ActionController::RoutingError)


12
13
14
15
16
17
18
# File 'app/controllers/library_controller.rb', line 12

def show
  suffix = params[:format] == 'erb' ? ".erb" : "/**/*.erb"
  dir = Dir.glob("#{Rails.root}/app/views/#{@configuration[:root_directory]}/#{params[:path]}#{suffix}").sort
  @library = Library::Librarian.new(dir, @configuration, params[:path])

  raise ActionController::RoutingError.new('Not Found') if @library.components.empty?
end