Class: Volt::App
Instance Attribute Summary collapse
-
#component_paths ⇒ Object
readonly
Returns the value of attribute component_paths.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#router ⇒ Object
readonly
Returns the value of attribute router.
Instance Method Summary collapse
-
#initialize(app_path) ⇒ App
constructor
A new instance of App.
- #require_http_controllers ⇒ Object
- #setup_router ⇒ Object
Constructor Details
#initialize(app_path) ⇒ App
Returns a new instance of App.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/volt/volt/app.rb', line 5 def initialize(app_path) # Setup root path Volt.root = app_path # Run the app config to load all users config files unless RUBY_PLATFORM == 'opal' if Volt.server? @page = Page.new # Setup a global for now $page = @page unless defined?($page) end end # Require in app and initializers unless RUBY_PLATFORM == 'opal' Volt.run_app_and_initializers end # Load component paths @component_paths = ComponentPaths.new(app_path) @component_paths.require_in_components(@page || $page) unless RUBY_PLATFORM == 'opal' setup_router require_http_controllers end end |
Instance Attribute Details
#component_paths ⇒ Object (readonly)
Returns the value of attribute component_paths.
3 4 5 |
# File 'lib/volt/volt/app.rb', line 3 def component_paths @component_paths end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/volt/volt/app.rb', line 3 def page @page end |
#router ⇒ Object (readonly)
Returns the value of attribute router.
3 4 5 |
# File 'lib/volt/volt/app.rb', line 3 def router @router end |
Instance Method Details
#require_http_controllers ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/volt/volt/app.rb', line 44 def require_http_controllers @component_paths.app_folders do |app_folder| # Sort so we get consistent load order across platforms Dir["#{app_folder}/*/controllers/server/*.rb"].each do |ruby_file| #path = ruby_file.gsub(/^#{app_folder}\//, '')[0..-4] #require(path) require(ruby_file) end end end |