Module: Birdie::Application

Defined in:
lib/birdie/application.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.appObject

Returns the value of attribute app.



7
8
9
# File 'lib/birdie/application.rb', line 7

def app
  @app
end

.rootObject

Returns the value of attribute root.



7
8
9
# File 'lib/birdie/application.rb', line 7

def root
  @root
end

Class Method Details

.extended(subclass) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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

Instance Method Details

#router(&block) ⇒ Object



29
30
31
# File 'lib/birdie/application.rb', line 29

def router(&block)
  @router ||= Lotus::Router.new(&block)
end