blob: 469055953370be693e297f845996734a3ad217fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# coding: utf-8
require 'yaml'
require 'uri'
class Config
def self.get
return @config ||= Config::new('config.yaml')
end
def initialize(filename)
@data = YAML::load(File::read(filename))
end
def url
return @url ||= URI::parse(@data['url'])
end
def html_suffixes
return @data['html_suffixes']
end
# Licenses
def default_license
return @default_license ||= @data['default_license']
end
def license_uri(name)
str = @data['license_uris'][name]
if str.nil?
return nil
end
return URI::parse(str)
end
# People
def default_author
return @default_person ||= @data['default_author']
end
def person_uri(name)
str = @data['person_uris'][name]
if str.nil?
return nil
end
return URI::parse(str)
end
def person_email(name)
return @data['person_emails'][name]
end
# Categories
def categories
return @data['categories'].keys
end
def category_name(abbr)
return @data['categories'][abbr]
end
end
|