Class: LibraryController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- LibraryController
- Defined in:
- app/controllers/library_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
4 5 6 7 |
# File 'app/controllers/library_controller.rb', line 4 def index dir = Dir.glob("#{Rails.root}/app/views/#{ComponentLibrary.root_directory}/**/*.erb") @library = Library::Librarian.new(dir, ComponentLibrary.root_directory) end |
#show ⇒ Object
9 10 11 12 13 14 |
# File 'app/controllers/library_controller.rb', line 9 def show suffix = params[:format] == 'erb' ? ".erb" : "/**/*.erb" dir = Dir.glob("#{Rails.root}/app/views/#{ComponentLibrary.root_directory}/#{params[:path]}#{suffix}") @library = Library::Librarian.new(dir, ComponentLibrary.root_directory, params[:path]) raise ActionController::RoutingError.new('Not Found') if @library.components.empty? end |