Skip to content
This repository has been archived by the owner on Jul 31, 2019. It is now read-only.

Commit

Permalink
Introduce Vienna::Application for controlling initializer flow
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Sep 5, 2013
1 parent 131b03f commit ef04746
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion app/app.rb
Expand Up @@ -12,7 +12,35 @@

require 'models/todo'

module Vienna
class << self
attr_accessor :application
end

class Application
class << self
def inherited(base)
Vienna.application ||= base.instance
end

def method_missing(sym, *args)
instance.__send__(sym, *args)
end

def instance
@instance ||= self.new
end
end
end
end

class Application < Vienna::Application
def run
@app_view = AppView.new
end
end

# when document is ready, lets go!
Document.ready? do
App = AppView.new
Application.run
end

0 comments on commit ef04746

Please sign in to comment.