Module: App

Defined in:
lib/app.rb,
lib/app.rb

Overview

App is your app.

What would your app be without it? Still an app, but without App.

Constant Summary collapse

VERSION =
"0.2.2"
@@config =

Initialize.

{}

Class Method Summary collapse

Class Method Details

.config(*args) ⇒ Object Also known as: []

Returns the application configuration hash, as defined in “config/app.yml”.

Follows args through the hash tree. E.g.:

App.config("apis", "flickr") # => config_hash["apis"]["flickr"]

App.config is aliased to App.[], so shorten things up:

App["apis", "flickr"]

Or rely on method_missing to make it even shorter (and sweeter):

App.apis("flickr")


23
24
25
26
# File 'lib/app.rb', line 23

def config(*args)
  @@config if args.empty?
  args.inject(@@config) { |config, arg| config[arg] }
end

.inspectObject



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

def inspect
  "#<#{name}: #{config.inspect}>"
end

.to_sObject

Returns the name of the web application, which can be overridden in “config/app.yml”.



55
56
57
# File 'lib/app.rb', line 55

def to_s
  File.basename(Rails.root)
end