Module: Rucola::RCApp
- Included in:
- RCController
- Defined in:
- lib/rucola/rucola_support/rc_app.rb
Class Method Summary collapse
-
.assets_path ⇒ Object
Returns the path to the current used app/assets dir.
-
.controllers_path ⇒ Object
Returns the path to the current used app/controllers dir.
-
.models_path ⇒ Object
Returns the path to the current used app/models dir.
-
.path_for_asset(asset) ⇒ Object
Returns the path to an
asset
file. -
.path_for_controller(controller) ⇒ Object
Returns the path to a
controller
file. -
.path_for_model(model) ⇒ Object
Returns the path to a
model
file. -
.path_for_view(view) ⇒ Object
Returns the path to a
view
file. -
.root_path ⇒ Object
Returns the path to the current source root of the application.
-
.views_path ⇒ Object
Returns the path to the current used app/views dir.
Class Method Details
.assets_path ⇒ Object
Returns the path to the current used app/assets dir.
So in debug & test mode this will point to your development source_root/app/assets.
In release however this will point to the equivalent of:
NSBundle.mainBundle.resourcePath + 'app/assets'
45 46 47 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 45 def assets_path (RUBYCOCOA_ROOT + 'app/assets').to_s end |
.controllers_path ⇒ Object
Returns the path to the current used app/controllers dir.
So in debug & test mode this will point to your development source_root/app/controllers.
In release however this will point to the equivalent of:
NSBundle.mainBundle.resourcePath + 'app/controllers'
21 22 23 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 21 def controllers_path (RUBYCOCOA_ROOT + 'app/controllers').to_s end |
.models_path ⇒ Object
Returns the path to the current used app/models dir.
So in debug & test mode this will point to your development source_root/app/models.
In release however this will point to the equivalent of:
NSBundle.mainBundle.resourcePath + 'app/models'
33 34 35 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 33 def models_path (RUBYCOCOA_ROOT + 'app/models').to_s end |
.path_for_asset(asset) ⇒ Object
95 96 97 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 95 def path_for_asset(asset) "#{assets_path}/#{asset}" end |
.path_for_controller(controller) ⇒ Object
65 66 67 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 65 def path_for_controller(controller) "#{controllers_path}/#{controller.name.to_s.snake_case}.rb" end |
.path_for_model(model) ⇒ Object
73 74 75 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 73 def path_for_model(model) "#{models_path}/#{model.name.to_s.snake_case}.rb" end |
.path_for_view(view) ⇒ Object
Returns the path to a view
file.
Rucola::RCApp.path_for_controller('preferences') #=> 'root/app/views/Preferences.nib'
Rucola::RCApp.path_for_controller('Preferences') #=> 'root/app/views/Preferences.nib'
Rucola::RCApp.path_for_controller(PreferencesController) #=> 'root/app/views/Preferences.nib'
Rucola::RCApp.path_for_controller(PreferencesController.alloc.init) #=> 'root/app/views/Preferences.nib'
85 86 87 88 89 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 85 def path_for_view(view) view = view.class unless view.is_a?(String) or view.is_a?(Class) view = view.name.to_s.sub(/Controller$/, '') if view.is_a? Class "#{views_path}/#{view.camel_case}.nib" end |
.root_path ⇒ Object
Returns the path to the current source root of the application.
So in debug & test mode this will point to your development source root.
In release however this will point to the equivalent of: NSBundle.mainBundle.resourcePath
9 10 11 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 9 def root_path RUBYCOCOA_ROOT.to_s end |
.views_path ⇒ Object
Returns the path to the current used app/views dir.
So in debug & test mode this will point to your development source_root/app/views.
In release however this will point to the equivalent of:
NSBundle.mainBundle.resourcePath + 'app/views'
57 58 59 |
# File 'lib/rucola/rucola_support/rc_app.rb', line 57 def views_path (RUBYCOCOA_ROOT + 'app/views').to_s end |