module Birdie::Application

Attributes

app[RW]
root[RW]

Public Class Methods

extended(subclass) click to toggle source
# File lib/birdie/application.rb, line 10
def self.extended(subclass)
  self.app = subclass
  call_stack = caller_locations.map(&:path)

  class << subclass
    attr_accessor :root
  end

  subclass.root = File.expand_path('../..', call_stack.find { |call| call !~ %r{lib/birdie} })

  relative_load_paths = %w[controllers builders]
  relative_load_paths = relative_load_paths.map do |path|
    File.expand_path("app/#{path}", subclass.root)
  end
  ActiveSupport::Dependencies.autoload_paths += relative_load_paths

  require File.join(subclass.root, 'config', 'routes.rb')
end

Public Instance Methods

router(&block) click to toggle source
# File lib/birdie/application.rb, line 29
def router(&block)
  @router ||= Lotus::Router.new(&block)
end