Guest User

Untitled

a guest
Feb 20th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. # This is the mechanism for setting up your application layout.
  2. # There are three application layouts in Merb:
  3. #
  4. # 1. Regular app/:type layout of Ruby on Rails fame:
  5. #
  6. # app/models for models
  7. # app/mailers for mailers (special type of controllers)
  8. # app/parts for parts, Merb components
  9. # app/views for templates
  10. # app/controllers for controller
  11. # lib for libraries
  12. #
  13. # 2. Flat application layout:
  14. #
  15. # application.rb for models, controllers, mailers, etc
  16. # config/init.rb for initialization and router configuration
  17. # config/framework.rb for framework and dependencies configuration
  18. # views for views
  19. #
  20. # 3. Camping-style "very flat" application layout, where the whole Merb
  21. # application and configs are contained within a single file.
  22. #
  23. # ==== Notes
  24. # Autoloading for lib uses an empty glob by default. If you
  25. # want to have your libraries under lib use autoload, add
  26. # the following to Merb init file:
  27. #
  28. # Merb.push_path(:lib, Merb.root / "lib", "**/*.rb") # glob set explicity.
  29. #
  30. # Then lib/magicwand/lib/magicwand.rb with MagicWand module will
  31. # be autoloaded when you first access that constant.
  32. #
  33. # ==== Examples
  34. # This method gives you a way to build up your own application
  35. # structure, for instance, to reflect the structure Rails
  36. # uses to simplify transition of legacy application, you can
  37. # set it up like this:
  38. #
  39. # Merb.push_path(:model, Merb.root / "app" / "models", "**/*.rb")
  40. # Merb.push_path(:mailer, Merb.root / "app" / "models", "**/*.rb")
  41. # Merb.push_path(:controller, Merb.root / "app" / "controllers", "**/*.rb")
  42. # Merb.push_path(:view, Merb.root / "app" / "views", "**/*.rb")
  43. #
  44. # ==== Parameters
  45. # type<Symbol>:: The type of path being registered (i.e. :view)
  46. # path<String>:: The full path
  47. # file_glob<String>::
  48. # A glob that will be used to autoload files under the path. Defaults to
  49. # "**/*.rb".
  50. #
  51. # @api public
  52. def push_path(type, path, file_glob = "**/*.rb")
  53. enforce!(type => Symbol)
  54. load_paths[type] = [path, file_glob]
  55. end
Add Comment
Please, Sign In to add comment