Class: Rambo::ApplicationContext
- Inherits:
-
Object
- Object
- Rambo::ApplicationContext
- Defined in:
- lib/rambo/application_context.rb
Instance Attribute Summary collapse
-
#application_name ⇒ Object
Returns the value of attribute application_name.
Instance Method Summary collapse
-
#initialize(application_name = nil) ⇒ ApplicationContext
constructor
A new instance of ApplicationContext.
- #load_classes ⇒ Object
- #reload ⇒ Object
- #view_path ⇒ Object
Constructor Details
#initialize(application_name = nil) ⇒ ApplicationContext
Returns a new instance of ApplicationContext.
5 6 7 8 9 10 11 |
# File 'lib/rambo/application_context.rb', line 5 def initialize(application_name = nil) @application_name = application_name puts "Initializing application: #{application_name || 'default'}" @prefix = "#{self.application_name}/" if self.application_name @prefix ||= '' load_classes end |
Instance Attribute Details
#application_name ⇒ Object
Returns the value of attribute application_name.
3 4 5 |
# File 'lib/rambo/application_context.rb', line 3 def application_name @application_name end |
Instance Method Details
#load_classes ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rambo/application_context.rb', line 13 def load_classes Dir["#{@prefix}controller/*.rb"].each { |x| funkyload x; } Dir["#{@prefix}model/*.rb"].each { |x| funkyload x } Dir["#{@prefix}lib/*.rb"].each { |x| funkyload x } Dir["#{@prefix}*.rb"].each { |x| funkyload x unless x == 'Rakefile.rb' } end |
#reload ⇒ Object
20 21 22 |
# File 'lib/rambo/application_context.rb', line 20 def reload load_classes end |
#view_path ⇒ Object
24 25 26 |
# File 'lib/rambo/application_context.rb', line 24 def view_path "./#{@prefix}view" end |