Class: Jun::Application
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize! ⇒ Boolean
Initializes the Jun application.
-
#initialized? ⇒ Boolean
Checks whether the Jun application has been initialized.
- #routes ⇒ Object
Class Method Details
Instance Method Details
#call(env) ⇒ Object
10 11 12 |
# File 'lib/jun/application.rb', line 10 def call(env) routes.call(env) end |
#initialize! ⇒ Boolean
Initializes the Jun application.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jun/application.rb', line 20 def initialize! return false if initialized? || Jun.application.nil? # Add app/* directories to autoload paths. Jun::ActiveSupport::Dependencies.autoload_paths += Jun.root.join("app").children # Set up routes and make its helpers available to controllers & views. require Jun.root.join("config/routes.rb") url_helpers = Jun.application.routes.url_helpers Jun::ActionController::Base.include(url_helpers) Jun::ActionView::Base.include(url_helpers) # Include all helpers in app/helpers directory. Dir.glob(Jun.root.join("app/helpers/**/*.rb")).each do |filepath| helper_class_name = File.basename(filepath, ".rb").camelize helper_class = Object.const_get(helper_class_name) Jun::ActionView::Base.include(helper_class) end @initialized = true end |
#initialized? ⇒ Boolean
Checks whether the Jun application has been initialized.
45 46 47 |
# File 'lib/jun/application.rb', line 45 def initialized? !!@initialized end |