Class: RubyMVC::AppController

Inherits:
Object
  • Object
show all
Includes:
LinkDispatcher
Defined in:
lib/ruby_mvc/controllers/app_controller.rb

Direct Known Subclasses

RailsController

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LinkDispatcher

#link_activated

Constructor Details

#initialize(app_file) ⇒ AppController

By convention, the application is configured using an app.yml file in the same directory as the application controller.



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ruby_mvc/controllers/app_controller.rb', line 60

def initialize(app_file)
  @config_file = File.expand_path(File.join(File.dirname(app_file), "../app.yml"))
  if !File.exist? @config_file
    @shoes.alert("Unable to locate configuration file.\nFile '#{@config_file}' not found.")
    @shoes.exit
  end

  @config = YAML.load(File.new(@config_file))
  setup
  run
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



54
55
56
# File 'lib/ruby_mvc/controllers/app_controller.rb', line 54

def app
  @app
end

Instance Method Details

#runObject

This method is a placeholder for the actual initialization to be performed by the Ruby application itself. It is called automatically by the constructor of the application controller.



77
78
# File 'lib/ruby_mvc/controllers/app_controller.rb', line 77

def run
end