Module: Terror
- Defined in:
- lib/terror.rb,
lib/terror/post.rb,
lib/terror/helper.rb,
lib/terror/installer.rb,
lib/terror/feed_fetcher.rb
Defined Under Namespace
Modules: FeedFetcher, Helper
Classes: Installer, Post
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
14
15
16
|
# File 'lib/terror.rb', line 14
def config
@config
end
|
Class Method Details
.init(config = nil) ⇒ Object
21
22
23
24
|
# File 'lib/terror.rb', line 21
def self.init(config = nil)
self.config = config.nil? ? YAML.load_file(File.join(Sinatra::Application.root, 'config', 'terror.yml')) : config
self.init_database
end
|
.init_database ⇒ Object
26
27
28
|
# File 'lib/terror.rb', line 26
def self.init_database
init_database_connection
end
|
.init_database_connection ⇒ Object
30
31
32
33
|
# File 'lib/terror.rb', line 30
def self.init_database_connection
DataMapper.setup(:default, self.config['database'][Sinatra::Application.environment.to_s])
DataMapper.auto_upgrade!
end
|
.root ⇒ Object
17
18
19
|
# File 'lib/terror.rb', line 17
def self.root
File.expand_path(File.dirname(__FILE__) + '/..')
end
|